/* Master's project: preview and reader use the actual pages of the thesis. */
#project-master-thesis .thesis-preview {
    display: flex;
    flex-direction: column;
    height: 280px;
    background: #eaf0f3;
    border-bottom: 1px solid var(--rule);
}
.thesis-preview-link {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 6px;
    flex: 1;
    min-height: 0;
    padding: 12px 16px 6px;
    text-decoration: none;
}
.thesis-preview-hint {
    justify-self: end;
    color: var(--accent);
    font: 600 0.65rem/1.4 var(--font-text);
}
#project-master-thesis .thesis-preview img,
#project-master-thesis:is(:hover, :focus-within) .thesis-preview img {
    width: 100%;
    height: 100%;
    max-height: 220px;
    object-fit: contain;
    transform: none;
    cursor: pointer;
    box-shadow: 0 3px 16px #0e1a2b16;
}
.thesis-preview-tabs {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 0 10px 12px;
}
.thesis-preview-tabs[hidden],
.thesis-preview-tabs button[hidden] { display: none; }
.thesis-preview-tabs button {
    min-height: 36px;
    padding: 6px 11px;
    border: 1px solid transparent;
    border-radius: 4px;
    font: 500 0.72rem var(--font-text);
    color: var(--ink-soft);
    background: transparent;
    cursor: pointer;
}
.thesis-preview-tabs button:hover { background: #ffffff80; }
.thesis-preview-tabs button[aria-pressed="true"] {
    border-color: #c8d2dd;
    background: var(--card);
    color: var(--accent);
}
#project-master-thesis .thesis-eyebrow {
    margin-bottom: 10px;
    color: var(--accent);
    font: 500 0.68rem/1.5 var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
#project-master-thesis .thesis-institution {
    color: var(--ink-mute);
    font-size: 0.8rem;
    line-height: 1.6;
}
.thesis-actions {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 12px 18px;
    margin-top: 18px;
}
.thesis-actions .project-link { margin: 0; }
.thesis-download {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink-soft);
    text-decoration: underline;
}
#project-master-thesis .thesis-file-meta {
    display: block;
    margin: 12px 0 0;
    color: var(--ink-mute);
    font: 400 0.66rem/1.6 var(--font-mono);
}
.thesis-reader {
    width: min(1440px, calc(100vw - 40px));
    max-width: none;
    max-height: calc(100dvh - 40px);
    padding: 0;
    margin: auto;
    border: 1px solid var(--rule);
    border-radius: 10px;
    color: var(--ink);
    background: var(--paper);
    box-shadow: 0 24px 100px #0008;
    overflow: hidden;
}
.thesis-reader:not([open]) { display: none; }
.thesis-reader[open] { display: flex; flex-direction: column; }
.thesis-reader::backdrop { background: #08111ddd; backdrop-filter: blur(6px); }
.thesis-reader-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--rule);
    flex-shrink: 0;
}
.thesis-reader-bar h2 {
    flex: 1 1 300px;
    margin: 0;
    font-size: 1.3rem;
    line-height: 1.2;
}
.thesis-reader-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.thesis-reader-bar a,
.thesis-reader-bar button,
.thesis-reader-toolbar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--rule);
    border-radius: 5px;
    background: var(--card);
    color: var(--ink);
    font: 600 0.76rem/1.3 var(--font-text);
    text-decoration: none;
    cursor: pointer;
}
.thesis-reader-bar a:hover,
.thesis-reader-bar button:hover,
.thesis-reader-toolbar button:not(:disabled):hover { background: var(--accent-soft); border-color: #b6c6e0; }
.thesis-reader-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 22px;
    flex-shrink: 0;
}
.thesis-reader-toolbar label {
    color: var(--ink-mute);
    font-size: 0.76rem;
}
.thesis-reader-toolbar select {
    min-width: 0;
    max-width: min(600px, 60vw);
    min-height: 42px;
    padding: 9px 30px 9px 12px;
    border: 1px solid var(--rule);
    border-radius: 5px;
    color: var(--ink);
    background: var(--card);
    font: 500 0.8rem var(--font-text);
    cursor: pointer;
}
.thesis-reader-toolbar button { min-width: 44px; font-size: 1.1rem; }
.thesis-reader-toolbar [data-thesis-zoom] { font-size: 0.76rem; }
.thesis-reader-toolbar [data-thesis-zoom][aria-pressed="true"] {
    background: var(--accent-soft);
    border-color: #b6c6e0;
    color: var(--accent);
}
.thesis-reader-toolbar button:disabled { opacity: 0.35; cursor: default; }
.thesis-page-stage {
    min-height: 0;
    max-height: calc(100dvh - 230px);
    padding: 0 22px 16px;
    overflow: auto;
    overscroll-behavior: contain;
    text-align: center;
}
.thesis-page-stage img {
    display: block;
    width: 100%;
    height: auto;
    max-height: calc(100dvh - 230px);
    object-fit: contain;
}
.thesis-page-stage.is-zoomed img {
    width: max(100%, 1440px);
    max-width: none;
    max-height: none;
}
.thesis-page-stage img[hidden],
#thesis-page-error[hidden] { display: none; }
.thesis-page-stage:focus-visible,
.thesis-reader-toolbar select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}
#thesis-page-error { margin: 30px 12px; font-size: 0.9rem; color: var(--ink-soft); }
#thesis-page-caption {
    margin: 12px 0 0;
    color: var(--ink-mute);
    font: 400 0.72rem/1.6 var(--font-mono);
}
@media (max-width: 640px) {
    .thesis-reader {
        width: calc(100vw - 16px);
        max-height: calc(100dvh - 16px);
        border-radius: 7px;
    }
    .thesis-reader-bar { padding: 12px; gap: 8px; }
    .thesis-reader-bar h2 { flex-basis: 100%; font-size: 1.15rem; }
    .thesis-reader-actions { width: 100%; }
    .thesis-reader-bar a,
    .thesis-reader-bar button { padding: 8px 10px; font-size: 0.68rem; }
    .thesis-reader-bar [data-thesis-close] { margin-left: auto; }
    .thesis-reader-toolbar { padding: 10px 12px; gap: 8px; }
    .thesis-reader-toolbar label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .thesis-reader-toolbar select { flex: 1; max-width: calc(100% - 166px); font-size: 0.74rem; }
    .thesis-page-stage { padding: 0 8px 12px; max-height: calc(100dvh - 250px); }
    .thesis-page-stage img { max-height: calc(100dvh - 250px); }
}
