/* Combe viewer layout. */

/* Only the Combe manuscript viewer uses the wider site canvas. */
body.combe-viewer-body {
    box-sizing: border-box;
    width: min(calc(100% - 3rem), 1240px);
    max-width: 1240px;
    margin-left: auto;
    margin-right: auto;
    padding: 1.5rem 0;
}

.content-page.combe-viewer {
    box-sizing: border-box;
    max-width: 100%;
    width: 100%;
    margin: 0;
}

.combe-viewer > h1 {
    margin-bottom: 1.25rem;
}

.combe-section-heading {
    margin: 0 0 .75rem;
    color: #555;
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.combe-display-options {
    max-width: 700px;
    margin: .75rem 0 1rem;
    padding: .7rem .85rem;
    border: 1px solid var(--border);
    background: var(--light);
}

.combe-display-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .75rem 1.25rem;
}

.combe-control {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    min-width: 0;
}

.combe-control-label {
    position: relative;
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .88rem;
    font-weight: 600;
    color: #444;
}

.combe-control-label label {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .88rem;
    font-weight: 600;
    color: #444;
}

.combe-control select,
.combe-folio-jump select {
    max-width: 28rem;
    min-width: 12rem;
    padding: .45rem .6rem;
    font: inherit;
}

.combe-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    padding: 0;
    border: 1px solid #999;
    border-radius: 50%;
    background: transparent;
    color: #666;
    font: 600 .72rem/1 Georgia, serif;
    cursor: help;
}

.combe-help:hover,
.combe-help:focus-visible,
.combe-help[aria-expanded="true"] {
    border-color: var(--link);
    color: var(--link);
}

.combe-help:focus-visible,
.combe-image-toolbar button:focus-visible,
.combe-nav-link:focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 2px;
}

.combe-help-text {
    position: absolute;
    z-index: 20;
    top: calc(100% + .5rem);
    left: 0;
    width: min(19rem, 75vw);
    padding: .65rem .75rem;
    border: 1px solid #c9c9c9;
    border-radius: 4px;
    background: #fff;
    color: #333;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .14);
    font-size: .82rem;
    font-weight: normal;
    line-height: 1.45;
}

.combe-provenance {
    color: #666;
    font-size: .85rem;
}

.combe-provenance span[title] {
    overflow-wrap: anywhere;
}

.combe-llm-metadata {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    background: var(--light);
}

.combe-llm-metadata h2 {
    margin-top: 0;
}

.combe-llm-metadata dl {
    display: grid;
    grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr);
    gap: .45rem 1rem;
    margin: 1rem 0;
}

.combe-llm-metadata dt {
    font-weight: 600;
}

.combe-llm-metadata dd {
    margin: 0;
}

.combe-manuscript-navigation {
    max-width: 760px;
    margin: 1.25rem 0 1.5rem;
    padding: .85rem 1rem;
    border: 1px solid var(--border);
}

.combe-folio-navigation {
    display: grid;
    grid-template-columns: minmax(8rem, 1fr) minmax(8rem, .7fr) minmax(8rem, 1fr);
    align-items: center;
    gap: 1rem;
}

.combe-nav-link {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    width: fit-content;
    padding: .45rem .65rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--light);
    color: var(--link);
    text-decoration: none;
}

.combe-nav-link:hover {
    background: #f0f4f7;
    text-decoration: none;
}

.combe-nav-next {
    justify-self: end;
    text-align: right;
}

.combe-nav-detail {
    color: #666;
    font-size: .8rem;
}

.combe-current-folio {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .1rem;
    text-align: center;
}

.combe-current-folio strong {
    color: var(--heading);
    font-size: 1.35rem;
    font-weight: normal;
}

.combe-current-volume {
    color: #555;
    font-size: .85rem;
}

.combe-nav-link.is-disabled {
    color: #999;
    background: #fafafa;
    cursor: default;
}

.combe-folio-jump {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    margin-top: 1rem;
}

.combe-folio-jump select {
    min-width: 8rem;
    max-width: 14rem;
}


.combe-spread {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.combe-panel {
    min-width: 0;
}

.combe-panel h2 {
    border-bottom: 1px solid var(--border);
    padding-bottom: .35rem;
}

.combe-image-viewer {
    position: relative;
    width: 100%;
    height: min(78vh, 900px);
    min-height: 420px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #111;
}

.combe-image-toolbar {
    position: absolute;
    top: .75rem;
    left: .75rem;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: .3rem;
    padding: .35rem;
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 5px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}

.combe-image-toolbar button {
    min-width: 2rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--background);
    color: var(--text);
    padding: .3rem .55rem;
    font: inherit;
    cursor: pointer;
}

.combe-image-toolbar button:hover {
    background: var(--light);
}

.combe-zoom-level {
    min-width: 2.8rem;
    color: #555;
    font: .78rem Arial, sans-serif;
    text-align: center;
}

.combe-image-error {
    color: #9b2525;
    font-size: .9rem;
}

.combe-image-placeholder {
    border: 1px solid var(--border);
    background: var(--light);
    padding: 2rem;
    min-height: 20rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.combe-transcription {
    max-width: 68ch;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.65;
}

.combe-transcription p {
    max-width: none;
}

.combe-transcription del {
    text-decoration: line-through;
}

.combe-transcription table {
    width: auto;
}

.archive-filter {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-top: 1rem;
}

.archive-filter select {
    padding: .35rem .5rem;
    font: inherit;
}

.archive-table-wrapper {
    overflow-x: auto;
    margin-top: 1.5rem;
}

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

.archive-table th,
.archive-table td {
    border-bottom: 1px solid var(--border);
    padding: .55rem .65rem;
    text-align: left;
    vertical-align: top;
}

.archive-table th {
    white-space: nowrap;
}

.archive-table td:nth-child(n+5) {
    text-align: center;
}

@media (max-width: 1050px) {
    .combe-spread {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
    }
}

@media (max-width: 800px) {
    body.combe-viewer-body {
        width: auto;
        padding: 1rem;
    }

    .content-page.combe-viewer {
        width: auto;
    }

    .combe-display-form {
        align-items: stretch;
    }

    .combe-control {
        flex: 1 1 12rem;
    }

    .combe-control select {
        max-width: none;
        width: 100%;
    }

    .combe-spread {
        grid-template-columns: 1fr;
    }

    .combe-image-viewer {
        height: 65vh;
        min-height: 320px;
    }

    .combe-image-toolbar {
        top: .5rem;
        left: .5rem;
    }
}

@media (max-width: 480px) {
    .combe-folio-navigation {
        grid-template-columns: 1fr 1fr;
    }

    .combe-current-folio {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .combe-nav-next {
        justify-self: end;
    }

    .combe-folio-jump {
        flex-wrap: wrap;
    }

    .combe-image-viewer {
        height: 60vh;
        min-height: 280px;
    }

    .combe-image-toolbar {
        gap: .2rem;
        padding: .25rem;
    }

    .combe-image-toolbar button {
        padding: .25rem .45rem;
    }

    .combe-llm-metadata dl {
        grid-template-columns: 1fr;
        gap: .15rem;
    }
}


/* Compact the controls above the manuscript workspace. */
.combe-viewer > h1 {
    margin-bottom: .55rem;
}

.combe-display-options {
    max-width: none;
    margin: .35rem 0 .4rem;
    padding: .45rem .65rem;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
}

.combe-display-options .combe-section-heading {
    margin-bottom: .35rem;
    font-size: .72rem;
}

.combe-display-form {
    align-items: center;
    gap: .5rem 1rem;
}

.combe-control {
    flex-direction: row;
    align-items: center;
    gap: .45rem;
}

.combe-control select {
    min-width: 10rem;
    max-width: 24rem;
    padding: .3rem .5rem;
    font-size: .92rem;
}

.combe-control:nth-child(2) select {
    min-width: 20rem;
}

.combe-provenance {
    margin: .35rem 0 .55rem;
    line-height: 1.35;
}

.combe-manuscript-navigation {
    max-width: none;
    margin: .45rem 0 .8rem;
    padding: .45rem .65rem;
    border: 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.combe-manuscript-navigation .combe-section-heading {
    margin-bottom: .35rem;
    font-size: .72rem;
}

.combe-folio-navigation {
    grid-template-columns: 1fr auto 1fr;
    gap: .75rem;
}

.combe-nav-link {
    flex-direction: row;
    align-items: center;
    gap: .4rem;
    padding: .3rem .5rem;
    font-size: .9rem;
}

.combe-nav-detail {
    font-size: .75rem;
}

.combe-current-folio {
    flex-direction: row;
    align-items: baseline;
    gap: .55rem;
}

.combe-current-folio strong {
    font-size: 1.15rem;
}

.combe-current-volume {
    font-size: .8rem;
}

.combe-folio-jump {
    margin-top: .35rem;
    gap: .5rem;
}

.combe-folio-jump select {
    min-width: 6rem;
    padding: .25rem .45rem;
    font-size: .9rem;
}

@media (max-width: 800px) {
    .combe-control {
        flex-direction: column;
        align-items: stretch;
    }

    .combe-control:nth-child(2) select {
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .combe-current-folio {
        flex-direction: column;
        align-items: center;
        gap: .05rem;
    }
}


/* Single compact header row and single-line folio navigation. */
.combe-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin: 0 0 .45rem;
}

.combe-viewer-header > h1 {
    flex: 0 0 auto;
    margin: 0;
    white-space: nowrap;
}

.combe-viewer-header .combe-display-options {
    flex: 1 1 auto;
    max-width: 780px;
    margin: 0 0 0 auto;
    padding: .35rem .6rem;
    border: 1px solid var(--border);
    background: var(--light);
}

.combe-viewer-header .combe-display-options .combe-section-heading {
    margin: 0 0 .2rem;
}

.combe-viewer-header .combe-display-form {
    flex-wrap: nowrap;
    gap: .5rem 1rem;
}

.combe-viewer-header .combe-control {
    flex: 0 1 auto;
    min-width: 0;
}

.combe-viewer-header .combe-control:nth-child(2) {
    flex: 1 1 24rem;
}

.combe-viewer-header .combe-control select {
    width: 100%;
    min-width: 0;
    max-width: none;
}

.combe-viewer-header .combe-control:nth-child(1) select {
    min-width: 9rem;
}

.combe-viewer-header .combe-control:nth-child(2) select {
    min-width: 15rem;
}

.combe-viewer .combe-provenance {
    margin: .2rem 0 .4rem;
}

.combe-viewer nav.combe-manuscript-navigation {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
    max-width: none;
    margin: .35rem 0 .65rem;
    padding: .35rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.combe-viewer nav.combe-manuscript-navigation .combe-nav-link {
    width: fit-content;
    white-space: nowrap;
}

.combe-viewer nav.combe-manuscript-navigation .combe-nav-next {
    justify-self: end;
}

.combe-viewer nav.combe-manuscript-navigation .combe-folio-jump {
    justify-content: center;
    margin: 0;
    white-space: nowrap;
}

.combe-viewer nav.combe-manuscript-navigation .combe-folio-jump select {
    width: auto;
    min-width: 6.5rem;
    max-width: 9rem;
}

.combe-spread {
    margin-top: .75rem;
}

@media (max-width: 900px) {
    .combe-viewer-header {
        align-items: flex-start;
        flex-direction: column;
        gap: .5rem;
    }

    .combe-viewer-header .combe-display-options {
        width: 100%;
        max-width: none;
        margin: 0;
    }

    .combe-viewer-header .combe-display-form {
        flex-wrap: wrap;
    }
}

@media (max-width: 600px) {
    .combe-viewer nav.combe-manuscript-navigation {
        grid-template-columns: 1fr 1fr;
        gap: .5rem;
    }

    .combe-viewer nav.combe-manuscript-navigation .combe-folio-jump {
        grid-column: 1 / -1;
        grid-row: 1;
        justify-content: center;
    }

    .combe-viewer nav.combe-manuscript-navigation .combe-nav-next {
        justify-self: end;
    }

    .combe-viewer-header .combe-control {
        flex-direction: column;
        align-items: stretch;
    }
}


/* Keep the title and display controls aligned without label/select collisions. */
.combe-viewer-header {
    display: grid;
    grid-template-columns: minmax(max-content, auto) minmax(0, 1fr);
    align-items: center;
    column-gap: 1.5rem;
}

.combe-viewer-header .combe-display-options {
    box-sizing: border-box;
    width: 100%;
    max-width: 780px;
    min-width: 0;
    margin: 0 0 0 auto;
    padding: .35rem .6rem .45rem;
}

.combe-viewer-header .combe-display-form {
    display: grid;
    grid-template-columns: minmax(9rem, .8fr) minmax(0, 1.5fr);
    align-items: end;
    gap: .45rem .9rem;
}

.combe-viewer-header .combe-control {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .2rem;
    min-width: 0;
}

.combe-viewer-header .combe-control-label {
    min-height: 1.15rem;
}

.combe-viewer-header .combe-control select,
.combe-viewer-header .combe-control:nth-child(1) select,
.combe-viewer-header .combe-control:nth-child(2) select {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: none;
}

.combe-index-provenance {
    margin-top: .65rem;
    padding-top: .4rem;
    border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
    .combe-viewer-header {
        display: flex;
        align-items: stretch;
        flex-direction: column;
        gap: .55rem;
    }

    .combe-viewer-header .combe-display-options {
        max-width: none;
        margin: 0;
    }
}

@media (max-width: 520px) {
    .combe-viewer-header .combe-display-form {
        grid-template-columns: 1fr;
    }
}

/* Help notice beside the transcription options heading. */
.combe-options-heading {
    margin-bottom: .35rem;
}

.combe-options-heading .combe-section-heading {
    margin: 0;
}

.combe-options-heading .combe-help-text {
    width: min(28rem, 80vw);
}


/* Smaller, icon-only image toolbar controls. */
.combe-image-toolbar button {
    box-sizing: border-box;
    min-width: 1.6rem;
    padding: .24rem .4rem;
    font-size: .8em;
    line-height: 1.2;
}


/* Expandable, schema-driven LLM extraction audit categories. */
.combe-llm-audit {
    margin: 1.25rem 0;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    background: var(--light);
}

.combe-llm-audit > h2 {
    margin-top: 0;
}

.combe-audit-category {
    border-top: 1px solid var(--border);
    padding: .65rem 0;
}

.combe-audit-category:last-child {
    border-bottom: 1px solid var(--border);
}

.combe-audit-category > summary {
    color: var(--heading);
    font-weight: 600;
    cursor: pointer;
}

.combe-audit-record {
    display: grid;
    grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr);
    gap: .4rem 1rem;
    margin: .85rem 0;
}

.combe-audit-record + .combe-audit-record {
    border-top: 1px dashed var(--border);
    padding-top: .85rem;
}

.combe-audit-record dt {
    font-weight: 600;
}

.combe-audit-record dd {
    min-width: 0;
    margin: 0;
}

.combe-audit-record pre {
    max-height: 32rem;
    margin: 0;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font: .82rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}

@media (max-width: 600px) {
    .combe-audit-record {
        grid-template-columns: 1fr;
        gap: .15rem;
    }

    .combe-audit-record dd {
        margin-bottom: .5rem;
    }
}
