/**
 * UZH CLASP — Supplementary Styling.
 * Integrates Junicode font, responsive verse reader, server SVG charts, and admin UI.
 */

@font-face {
    font-family: 'Junicode';
    src: url('../fonts/junicode/Junicode.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Junicode';
    src: url('../fonts/junicode/Junicode-Italic.woff') format('woff');
    font-weight: normal;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Junicode';
    src: url('../fonts/junicode/Junicode-Bold.woff') format('woff');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

/* ==========================================================================
   Typography & Verse Reader
   ========================================================================== */
.font-junicode {
    font-family: 'Junicode', 'Georgia', serif;
}

.verse-reader {
    background: #ffffff;
    border: 1px solid #e0e5eb;
    border-radius: 6px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 2px 6px rgba(0, 40, 165, 0.04);
}

.verse-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Junicode', 'Georgia', serif;
    font-size: 1.12rem;
    line-height: 1.8;
}

.verse-table tr {
    transition: background 0.15s ease;
}

.verse-table tr:hover {
    background: #f4f6fa;
}

.verse-table td.ref-col {
    width: 60px;
    vertical-align: top;
    text-align: right;
    padding-right: 18px;
    color: #83909c;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.85rem;
    user-select: none;
    padding-top: 3px;
}

.verse-table td.line-col {
    vertical-align: top;
    padding: 3px 0;
    color: #1a1a1a;
}

.verse-table .caesura {
    color: #0028a5;
    opacity: 0.35;
    margin: 0 8px;
    font-weight: normal;
    font-family: sans-serif;
}

.verse-table .scansion {
    display: block;
    font-size: 0.8rem;
    font-family: 'Source Sans 3', sans-serif;
    color: #7b8a97;
    margin-top: -2px;
}

.view-mode-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    align-items: center;
}

.view-mode-btn {
    padding: 6px 14px;
    font-size: 0.88rem;
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
}

.view-mode-btn.active {
    background: #0028a5;
    color: #fff;
    border-color: #0028a5;
}

/* ==========================================================================
   Corpus Stats Grid
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 24px 0 32px 0;
}

.stat-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-top: 3px solid #0028a5;
    border-radius: 6px;
    padding: 16px;
    text-align: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 40, 165, 0.08);
}

.stat-card .num {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #0028a5;
    line-height: 1.1;
    margin-bottom: 4px;
}

.stat-card .lbl {
    font-size: 0.88rem;
    color: #475569;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ==========================================================================
   Visualisations & Server SVG Charts (MLGB-style)
   ========================================================================== */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 24px;
    margin: 28px 0;
}

.chart-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.chart-card h3 {
    margin: 0 0 6px 0;
    font-size: 1.15rem;
    color: #0028a5;
}

.chart-card .subtitle {
    margin: 0 0 16px 0;
    font-size: 0.85rem;
    color: #64748b;
}

/* Column SVG Chart */
svg.spark {
    width: 100%;
    height: auto;
    overflow: visible;
    display: block;
}

svg.spark line.axis {
    stroke: #cbd5e1;
    stroke-width: 1.2;
}

svg.spark text {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 11px;
    fill: #64748b;
}

svg.spark text.axis-max {
    font-size: 10px;
    fill: #94a3b8;
    font-weight: 600;
}

svg.spark rect.hit {
    fill: transparent;
    cursor: pointer;
}

svg.spark rect.col {
    fill: #0028a5;
    transition: fill 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

svg.spark a.colg {
    cursor: pointer;
}

svg.spark a.colg:hover rect.col,
svg.spark g:hover rect.col {
    fill: #d2821e;
    filter: drop-shadow(0 4px 6px rgba(210, 130, 30, 0.4));
}

svg.spark text.col-val {
    font-size: 11px;
    fill: #0028a5;
    font-weight: 700;
    transition: fill 0.15s ease;
}

svg.spark a.colg:hover text.col-val {
    fill: #d2821e;
    font-size: 12px;
}

svg.spark text.col-label {
    font-size: 11px;
    fill: #475569;
    font-weight: 600;
    transition: fill 0.15s ease;
}

svg.spark a.colg:hover text.col-label {
    fill: #0028a5;
    font-weight: 700;
}

/* Horizontal Bar Chart */
.bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bars a.bar,
.bars div.bar {
    display: grid;
    grid-template-columns: minmax(180px, 1.4fr) 2fr 60px;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
    color: #1e293b;
    text-decoration: none;
    padding: 6px 8px;
    border-radius: 6px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.bars a.bar {
    cursor: pointer;
}

.bars a.bar:hover {
    background: #f0f7ff;
    transform: translateX(4px);
    box-shadow: inset 3px 0 0 0 #0028a5;
}

.bars a.bar:hover .lab {
    color: #0028a5;
    font-weight: 700;
}

.bars .lab {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    transition: color 0.15s ease;
}

.bars .track {
    background: #e2e8f0;
    border-radius: 4px;
    height: 12px;
    position: relative;
    overflow: hidden;
    display: block;
}

.bars .fill {
    display: block;
    height: 100%;
    background: #0028a5;
    border-radius: 4px;
    min-width: 6px;
    transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1), background 0.2s ease;
}

.bars a.bar:hover .fill {
    background: linear-gradient(90deg, #0028a5, #d2821e);
    filter: drop-shadow(0 2px 4px rgba(0, 40, 165, 0.3));
}

.bars .val {
    text-align: right;
    color: #64748b;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Stacked Proportion Bar */
.stack {
    display: flex;
    height: 22px;
    border-radius: 6px;
    overflow: hidden;
    margin: 14px 0 10px 0;
    background: #e2e8f0;
}

.stack a,
.stack span {
    display: block;
    height: 100%;
    transition: opacity 0.2s ease;
}

.stack a:hover {
    opacity: 0.85;
}

.legend.stack-key {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 0.85rem;
    color: #475569;
}

.legend.stack-key a,
.legend.stack-key span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: inherit;
}

.legend.stack-key i {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* ==========================================================================
   Admin & Forms
   ========================================================================== */
.admin-badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

.admin-badge.badge-ang {
    background: #e0f2fe;
    color: #0369a1;
}

.admin-badge.badge-lat {
    background: #fef3c7;
    color: #92400e;
}

.admin-badge.badge-pub {
    background: #dcfce7;
    color: #166534;
}

.admin-nav-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    padding: 12px;
    background: #f1f5f9;
    border-radius: 6px;
    align-items: center;
}

.admin-nav-bar a {
    font-weight: 600;
    color: #0028a5;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
}

.admin-nav-bar a.active,
.admin-nav-bar a:hover {
    background: #0028a5;
    color: #fff;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    margin: 16px 0;
}

.data-table th,
.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #334155;
}

.data-table tr:hover td {
    background: #f8fafc;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #1e293b;
    font-size: 0.92rem;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.95rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-family: inherit;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #0028a5;
    box-shadow: 0 0 0 3px rgba(0, 40, 165, 0.12);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.92rem;
}

.alert-success {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #14532d;
}

.alert-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

/* ==========================================================================
   Author Colophon & Footnote
   ========================================================================== */
.uzh-colophon {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #dbe2ea;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #475569;
}

.uzh-colophon a {
    color: #0028a5;
    text-decoration: underline;
}

/* Search Highlighting */
.search-snippet {
    font-size: 0.9rem;
    color: #475569;
    margin-top: 4px;
    line-height: 1.5;
}

.search-snippet b {
    color: #0028a5;
    background: #eff6ff;
    padding: 0 2px;
    border-radius: 2px;
}

/* ==========================================================================
   Micro-Animations, Wipes, Fades & Transitions
   ========================================================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0, 40, 165, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(0, 40, 165, 0);
    }
}

@keyframes pulseMarker {
    0% {
        r: 6;
        opacity: 1;
    }
    100% {
        r: 18;
        opacity: 0;
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes dropdownFade {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.fade-in-up {
    animation: fadeInUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hover-wipe {
    position: relative;
    overflow: hidden;
}

.hover-wipe::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #0028a5, #d2821e);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.hover-wipe:hover::after {
    transform: scaleX(1);
}

.card-interactive {
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease, border-color 0.22s ease;
    will-change: transform, box-shadow;
}

.card-interactive:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 40, 165, 0.1);
    border-color: #93c5fd;
}

/* ==========================================================================
   Hero Carousel with Rotating CC Manuscript Backgrounds
   ========================================================================== */
.hero-carousel {
    position: relative;
    border-radius: 10px;
    overflow: visible;
    margin-bottom: 36px;
    min-height: 400px;
    display: flex;
    align-items: center;
    box-shadow: 0 16px 40px rgba(0, 32, 120, 0.2);
    background: #020c22;
    z-index: 20;
}

.hero-slides-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 10px;
    z-index: 1;
}

.hero-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: right center;
    opacity: 0;
    transition: opacity 1.2s ease-in-out, transform 10s ease-out;
    transform: scale(1.0);
    filter: brightness(1.08) contrast(1.18) saturate(1.12);
}

.hero-slide.is-active {
    opacity: 0.95;
    transform: scale(1.04);
}

.hero-overlay {
    position: absolute;
    inset: 0;
    border-radius: 10px;
    z-index: 2;
    background: linear-gradient(90deg, 
        rgba(2, 12, 38, 0.96) 0%, 
        rgba(2, 14, 46, 0.92) 55%, 
        rgba(4, 18, 58, 0.65) 82%, 
        rgba(2, 10, 30, 0.35) 100%
    );
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 25;
    padding: 38px 44px;
    max-width: 1180px;
    color: #ffffff;
    pointer-events: none;
}

.hero-content > * {
    pointer-events: auto;
}

.hero-institution {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.82rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.15);
    padding: 5px 12px;
    border-radius: 20px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.hero-title {
    font-size: 2.9rem;
    font-weight: 800;
    line-height: 1.12;
    margin: 0 0 14px 0;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.22rem;
    line-height: 1.55;
    margin: 0 0 26px 0;
    color: rgba(255, 255, 255, 0.94);
    max-width: 980px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Big Prominent Hero Search */
.hero-search-wrapper {
    position: relative;
    max-width: 1140px;
    width: 100%;
    margin-bottom: 20px;
    z-index: 50;
}

.hero-search-form {
    position: relative;
    z-index: 60;
    display: flex;
    align-items: stretch;
    background: #ffffff;
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(255, 255, 255, 0.25);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.hero-search-form:focus-within,
.hero-search-form.has-dropdown {
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.45), 0 0 0 4px rgba(210, 130, 30, 0.6);
    transform: translateY(-2px);
}

.hero-search-icon {
    display: flex;
    align-items: center;
    padding-left: 14px;
    padding-right: 4px;
    color: #0028a5;
    flex-shrink: 0;
}

.hero-search-input-wrap {
    flex: 1;
    min-width: 0;
    position: relative;
    display: flex;
    align-items: center;
}

.hero-search-input-wrap .pred-spinner {
    right: 12px;
}

.hero-search-input {
    width: 100%;
    flex: 1;
    min-width: 0;
    border: none;
    font-size: 1.15rem;
    padding: 12px 14px;
    color: #0f172a;
    font-family: inherit;
    outline: none;
    background: transparent;
}

.hero-search-input::placeholder {
    color: #64748b;
    font-size: 0.98rem;
    letter-spacing: -0.01em;
}

.hero-search-button {
    background: #d2821e;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 0 28px;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    white-space: nowrap;
}

.hero-search-button:hover {
    background: #b56a12;
    transform: scale(1.02);
}

/* Quick Search Chips */
.hero-chips {
    position: relative;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}

.hero-chips-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 4px;
}

.hero-chip {
    display: inline-block;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.18s ease;
    backdrop-filter: blur(4px);
}

.hero-chip:hover {
    background: #ffffff;
    color: #0028a5;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Hero Manuscript Credit Badge */
.hero-mss-badge {
    position: absolute;
    bottom: 16px;
    right: 20px;
    z-index: 10;
    background: rgba(2, 14, 46, 0.82);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.95);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.hero-mss-badge:hover {
    background: rgba(0, 40, 165, 0.92);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 40, 165, 0.4);
}

.hero-mss-badge i {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d2821e;
    box-shadow: 0 0 6px #d2821e;
}

.hero-mss-zoom-btn {
    transition: background 0.2s ease;
}

.hero-mss-badge:hover .hero-mss-zoom-btn {
    background: rgba(255, 255, 255, 0.35) !important;
}

/* Slider Controls & Prev/Next Arrows */
.hero-controls {
    position: absolute;
    bottom: 16px;
    left: 44px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
}

.hero-arrow {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 700;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
    backdrop-filter: blur(4px);
}

.hero-arrow:hover {
    background: #ffffff;
    color: #0028a5;
    transform: scale(1.12);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.hero-dots {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.hero-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    padding: 0;
}

.hero-dot.is-active {
    background: #ffffff;
    width: 26px;
    border-radius: 6px;
}

/* ==========================================================================
   Predictive Search (Dropdown & Autocomplete)
   ========================================================================== */
.predictive-wrapper {
    position: relative;
    width: 100%;
}

.predictive-wrapper .pred-spinner {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #0028a5;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.predictive-wrapper.is-loading .pred-spinner {
    opacity: 1;
    animation: spin 0.8s linear infinite;
}

.predictive-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff !important;
    color: #1e293b !important;
    text-align: left !important;
    text-shadow: none !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0, 20, 70, 0.35), 0 4px 14px rgba(0, 0, 0, 0.1) !important;
    z-index: 99999 !important;
    max-height: 480px;
    overflow-y: auto;
    animation: dropdownFade 0.18s cubic-bezier(0.16, 1, 0.3, 1) both;
    font-family: -apple-system, BlinkMacSystemFont, 'Source Sans 3', sans-serif;
}

.predictive-dropdown * {
    text-shadow: none !important;
    box-sizing: border-box;
}

.pred-group {
    border-bottom: 1px solid #f1f5f9;
}

.pred-group:last-of-type {
    border-bottom: none;
}

.pred-group-title {
    background: #f8fafc !important;
    padding: 8px 16px !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    color: #475569 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-top: 1px solid #edf2f7 !important;
}

.pred-group-title:first-child {
    border-top: none !important;
}

.pred-count {
    background: #e2e8f0 !important;
    color: #334155 !important;
    padding: 1px 7px !important;
    border-radius: 10px !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
}

.pred-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 4px 0 !important;
}

.pred-item {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    transition: background 0.12s ease;
}

.pred-item.is-selected,
.pred-item:hover {
    background: #eff6ff !important;
}

.pred-link {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 10px 16px !important;
    text-decoration: none !important;
    color: #1e293b !important;
    gap: 12px !important;
}

.pred-body {
    flex: 1;
    min-width: 0;
}

.pred-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.pred-title {
    font-weight: 700 !important;
    font-size: 0.96rem !important;
    color: #0028a5 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pred-item:hover .pred-title,
.pred-item.is-selected .pred-title {
    color: #001f7a !important;
}

.pred-mark {
    background: #fef08a !important;
    color: #78350f !important;
    font-weight: 800 !important;
    border-radius: 2px !important;
    padding: 0 2px !important;
}

.pred-subtitle {
    font-size: 0.82rem !important;
    color: #475569 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px !important;
}

.pred-badge {
    display: inline-block !important;
    padding: 2px 7px !important;
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    border-radius: 10px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    flex-shrink: 0;
}

.pred-badge-ang {
    background: #e0f2fe !important;
    color: #0369a1 !important;
}

.pred-badge-lat {
    background: #fef3c7 !important;
    color: #92400e !important;
}

.pred-badge-poet {
    background: #ede9fe !important;
    color: #6d28d9 !important;
}

.pred-badge-bib {
    background: #dcfce7 !important;
    color: #166534 !important;
}

.pred-badge-default {
    background: #f1f5f9 !important;
    color: #475569 !important;
}

.pred-arrow {
    color: #94a3b8 !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    transition: transform 0.15s ease, color 0.15s ease;
}

.pred-item:hover .pred-arrow,
.pred-item.is-selected .pred-arrow {
    color: #0028a5 !important;
    transform: translateX(3px);
}

.pred-empty {
    padding: 28px 20px !important;
    text-align: center !important;
    color: #475569 !important;
    background: #ffffff !important;
}

.pred-empty-title {
    font-size: 1.05rem !important;
    color: #0f172a !important;
    font-weight: 700 !important;
    margin: 0 0 8px 0 !important;
}

.pred-empty-sub {
    font-size: 0.88rem !important;
    color: #475569 !important;
    margin: 0 0 16px 0 !important;
    line-height: 1.5 !important;
}

.pred-empty-sub code {
    background: #f1f5f9 !important;
    color: #0028a5 !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    font-weight: 700 !important;
    border: 1px solid #e2e8f0 !important;
}

.pred-footer {
    padding: 10px 16px !important;
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 0.82rem !important;
    color: #475569 !important;
}

.pred-view-all {
    color: #0028a5 !important;
    font-weight: 700 !important;
    text-decoration: none !important;
}

.pred-view-all:hover {
    text-decoration: underline !important;
    color: #001f7a !important;
}

.pred-kbd-hint {
    color: #64748b !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
}

.pred-kbd-hint kbd {
    background: #e2e8f0 !important;
    border: 1px solid #cbd5e1 !important;
    color: #1e293b !important;
    border-radius: 3px !important;
    padding: 1px 5px !important;
    font-family: monospace !important;
    font-weight: 700 !important;
}

/* ==========================================================================
   Scholarly Cambridge Footnote Styling (Matching Dionysius)
   ========================================================================== */
.footer-credits {
    font-size: 0.88rem;
    line-height: 1.65;
    color: #475569;
}

.footer-credits a {
    color: #0028a5;
    font-weight: 600;
    text-decoration: underline;
    transition: color 0.15s ease;
}

.footer-credits a:hover {
    color: #d2821e;
}

.footer-scholarly-meta {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #cbd5e1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-scholarly-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.84rem;
}

.footer-scholarly-row .meta-label {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-scholarly-row .meta-pub {
    color: #334155;
}

.btn-cite-mini {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    color: #0028a5;
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.15s ease;
}

.btn-cite-mini:hover {
    background: #0028a5;
    color: #ffffff !important;
    border-color: #0028a5;
}

/* ==========================================================================
   Visualisations: Network Diagram & Map of Sources
   ========================================================================== */
.vis-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 24px;
}

.vis-tab-btn {
    padding: 10px 18px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    background: transparent;
    color: #64748b;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.vis-tab-btn:hover {
    color: #0028a5;
}

.vis-tab-btn.is-active {
    color: #0028a5;
    border-bottom-color: #0028a5;
    background: #eff6ff;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.vis-panel {
    display: none;
}

.vis-panel.is-active {
    display: block;
    animation: fadeInUp 0.35s ease both;
}

/* Visualise Corpus Insights Interactive Rows */
.vis-insight-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

.vis-insight-row:hover,
.vis-insight-row:focus-visible {
    background: #f0f7ff;
    border-color: #93c5fd;
    box-shadow: 0 3px 12px rgba(0, 40, 165, 0.08);
    transform: translateX(4px);
    outline: none;
}

.vis-insight-row:active {
    background: #e0f2fe;
    transform: translateX(2px);
}

.vis-insight-row:hover .vis-insight-author {
    color: #0028a5 !important;
}

.vis-insight-row:hover .vis-insight-label {
    color: #0f172a !important;
}

.vis-insight-row:hover .vis-insight-arrow {
    color: #0028a5 !important;
    transform: translateX(3px);
}

.vis-insight-arrow {
    color: #94a3b8;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    display: inline-block;
}

.vis-insight-badge {
    transition: all 0.2s ease;
}

.vis-insight-row:hover .vis-insight-badge {
    background: #0284c7 !important;
    color: #ffffff !important;
}

/* SVG Network Diagram */
.network-container {
    position: relative;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.network-svg {
    width: 100%;
    height: auto;
    display: block;
}

.network-node {
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.network-node:hover {
    filter: drop-shadow(0 4px 12px rgba(0, 40, 165, 0.45));
}

.network-edge {
    stroke-opacity: 0.35;
    transition: stroke-opacity 0.2s ease, stroke-width 0.2s ease;
}

.network-edge.is-highlighted {
    stroke-opacity: 0.95;
    stroke-width: 3.5;
}

/* Map of Sources */
.map-container {
    position: relative;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.map-svg {
    width: 100%;
    height: auto;
    display: block;
}

.map-pin {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.map-pin:hover circle.pin-head {
    fill: #d2821e;
    r: 9;
}

.map-pin-pulse {
    animation: pulseMarker 2s infinite cubic-bezier(0.25, 1, 0.5, 1);
}

.map-tooltip {
    position: absolute;
    background: #0f172a;
    color: #ffffff;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.82rem;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.15s ease;
}

/* Collection Insights KPI Grid */
.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.insight-kpi {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 22px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 40, 165, 0.04);
}

.insight-kpi-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #0028a5, #d2821e);
}

.insight-kpi-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: #0028a5;
    line-height: 1.1;
    margin: 4px 0;
}

.insight-kpi-label {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
}

.insight-kpi-sub {
    font-size: 0.88rem;
    color: #64748b;
    margin-top: 8px;
    line-height: 1.5;
}

/* Global Subtle Insular Manuscript Watermarks for Background Ambience */
body.template-default {
    background-color: #f8fafc;
    position: relative;
    min-height: 100vh;
}

body.template-default::before {
    content: "";
    position: fixed;
    top: 60px;
    right: 0;
    width: 480px;
    height: 720px;
    background-image: url('../images/manuscripts/cerne.jpg');
    background-size: cover;
    background-position: top right;
    opacity: 0.040;
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: multiply;
    filter: sepia(35%) contrast(1.2);
}

body.template-default::after {
    content: "";
    position: fixed;
    bottom: 0;
    left: 0;
    width: 440px;
    height: 540px;
    background-image: url('../images/manuscripts/beowulf.jpg');
    background-size: cover;
    background-position: bottom left;
    opacity: 0.035;
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: multiply;
    filter: sepia(25%) contrast(1.1);
}

/* Watermark Background for Content Areas */
.mss-watermark {
    position: relative;
}

.mss-watermark::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 260px;
    height: 260px;
    background-image: url('../images/manuscripts/beowulf.jpg');
    background-size: cover;
    opacity: 0.035;
    pointer-events: none;
    mask-image: radial-gradient(circle, black 30%, transparent 70%);
}

/* ==========================================================================
   Page Hero Banners with CC Manuscript Imagery
   ========================================================================== */
.page-hero-banner {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 30px;
    background: #020c22;
    box-shadow: 0 14px 34px rgba(0, 32, 120, 0.16);
    color: #ffffff;
    min-height: 210px;
    display: flex;
    align-items: center;
}

.page-hero-banner .banner-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: right center;
    opacity: 0.92;
    transition: transform 9s ease, opacity 0.5s ease;
    transform: scale(1.0);
    filter: brightness(1.08) contrast(1.18) saturate(1.12);
}

.page-hero-banner:hover .banner-bg {
    transform: scale(1.04);
    opacity: 0.98;
}

.page-hero-banner .banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, 
        rgba(2, 12, 38, 0.95) 0%, 
        rgba(2, 14, 46, 0.86) 45%, 
        rgba(4, 18, 58, 0.42) 78%, 
        rgba(2, 10, 30, 0.25) 100%
    );
    pointer-events: none;
}

.page-hero-banner .banner-content {
    position: relative;
    z-index: 2;
    padding: 38px 36px;
    max-width: 940px;
}

.page-hero-banner .banner-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.page-hero-banner h1 {
    font-size: 2.35rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 10px 0;
    line-height: 1.16;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.page-hero-banner p.lede {
    font-size: 1.08rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.93);
    margin: 0;
    max-width: 860px;
}

.page-hero-banner .banner-meta {
    margin-top: 14px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
}

/* ==========================================================================
   Research Question Generator & Selector (Codicology & Insights)
   ========================================================================== */
.rq-box {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 26px;
    margin-bottom: 30px;
    box-shadow: 0 4px 18px rgba(0, 40, 165, 0.06);
}

.rq-card-active {
    background: #f8fafc;
    border: 1px solid #bfdbfe;
    border-left: 5px solid #0028a5;
    border-radius: 8px;
    padding: 22px 24px;
    margin-top: 18px;
    transition: all 0.25s ease;
}

.rq-chips-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.rq-query-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eff6ff;
    color: #0028a5;
    border: 1px solid #bfdbfe;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.18s ease;
}

.rq-query-chip:hover {
    background: #0028a5;
    color: #ffffff;
    border-color: #0028a5;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(0, 40, 165, 0.25);
}

/* ==========================================================================
   Manuscripts Gallery, Lightbox & Visual Transitions
   ========================================================================== */

/* Shimmer Sheen Hover Wipe */
.sheen-wipe {
    position: relative;
    overflow: hidden;
}
.sheen-wipe::before {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    transform: skewX(-25deg);
    transition: left 0.75s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 5;
}
.sheen-wipe:hover::before {
    left: 200%;
}

/* Staggered Slide-In Animations */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.slide-in-left {
    animation: slideInLeft 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.slide-in-right {
    animation: slideInRight 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.scale-up {
    animation: scaleUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Manuscript Showcase Grid */
.mss-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.mss-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
    position: relative;
}

.mss-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 36px rgba(0, 40, 165, 0.12);
    border-color: #93c5fd;
}

.mss-img-wrap {
    height: 220px;
    width: 100%;
    position: relative;
    overflow: hidden;
    background: #0f172a;
    cursor: pointer;
}

.mss-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), filter 0.3s ease;
}

.mss-card:hover .mss-img {
    transform: scale(1.06);
    filter: brightness(1.05);
}

.mss-img-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.7) 100%);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 14px;
    color: #ffffff;
    pointer-events: none;
}

.mss-zoom-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 40, 165, 0.85);
    backdrop-filter: blur(4px);
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    pointer-events: auto;
    transition: background 0.18s ease, transform 0.18s ease;
}

.mss-zoom-badge:hover {
    background: #d2821e;
    transform: scale(1.05);
}

.mss-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.mss-meta-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.mss-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mss-badge-codex {
    background: #eff6ff;
    color: #0028a5;
    border: 1px solid #bfdbfe;
}

.mss-badge-insular {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.mss-badge-cont {
    background: #faf5ff;
    color: #6d28d9;
    border: 1px solid #e9d5ff;
}

.mss-badge-gold {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Lightbox Modal */
.mss-modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(6px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.mss-modal-backdrop.is-open {
    display: flex;
    animation: scaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.mss-modal-dialog {
    background: #ffffff;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
    position: relative;
    display: flex;
    flex-direction: column;
}

.mss-modal-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
}

.mss-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s ease, background 0.15s ease;
}

.mss-modal-close:hover {
    color: #0028a5;
    background: #f1f5f9;
}

.mss-modal-img {
    width: 100%;
    max-height: 560px;
    object-fit: contain;
    background: #0f172a;
    display: block;
}

.mss-modal-footer {
    padding: 18px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

mark.kw-match {
    background: #fef08a;
    color: #854d0e;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 700;
}

/* ==========================================================================
   Language Selector (DE/EN & Multi-language discovery)
   ========================================================================== */
.Header--langSwitch {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.lang-switch-toggle {
    display: inline-flex;
    align-items: center;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 2px 5px;
    gap: 2px;
    font-size: 0.82rem;
    font-weight: 700;
}

.lang-pill {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 12px;
    text-decoration: none;
    line-height: 1.2;
    transition: background 0.15s ease, color 0.15s ease;
}

.lang-pill:hover {
    color: #0028a5;
    background: #e2e8f0;
}

.lang-pill.active {
    background: #0028a5 !important;
    color: #ffffff !important;
}

.lang-dropdown-select {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 4px 26px 4px 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2212%22%20height%3D%228%22%20viewBox%3D%220%200%2012%208%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M1.41%200L6%204.58L10.59%200L12%201.41L6%207.41L0%201.41L1.41%200Z%22%20fill%3D%22%2364748B%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px;
    appearance: none;
    -webkit-appearance: none;
}

.lang-dropdown-select:hover,
.lang-dropdown-select:focus {
    border-color: #0028a5;
    box-shadow: 0 0 0 2px rgba(0, 40, 165, 0.15);
}

@media (max-width: 768px) {
    .Header--langSwitch {
        margin-top: 6px;
        justify-content: center;
        width: 100%;
    }
}




/* ==========================================================================
   Fontes Anglo-Saxonici Specific Styles
   ========================================================================== */

/* Portal Feature Cards */
.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.portal-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.portal-card:hover {
    border-color: #0028a5;
    box-shadow: 0 10px 24px rgba(0, 40, 165, 0.09);
    transform: translateY(-3px);
}

.portal-icon {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: #e0e7ff;
    color: #0028a5;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 1.4rem;
}

.portal-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0028a5;
    margin: 0 0 8px 0;
}

.portal-desc {
    font-size: 0.92rem;
    line-height: 1.55;
    color: #475569;
    margin: 0 0 16px 0;
}

.portal-link-arrow {
    font-size: 0.88rem;
    font-weight: 700;
    color: #0028a5;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Sigil Badges */
.sigil-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    cursor: help;
}

.sigil-s1 { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.sigil-s2 { background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }
.sigil-s3 { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.sigil-sa { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.sigil-m1 { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.sigil-m2 { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }

/* Comparative Citation Table */
.citation-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.citation-header {
    background: #f8fafc;
    padding: 12px 18px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.citation-body {
    padding: 18px 20px;
}

.quote-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 16px;
    margin-bottom: 14px;
    align-items: baseline;
}

@media (max-width: 768px) {
    .quote-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

.quote-label {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.quote-text {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #0f172a;
}

.quote-source {
    border-left: 3px solid #0284c7;
    padding-left: 12px;
    background: #f0f9ff;
    padding: 10px 14px;
    border-radius: 0 4px 4px 0;
}

.quote-target {
    border-left: 3px solid #0028a5;
    padding-left: 12px;
    background: #f8fafc;
    padding: 10px 14px;
    border-radius: 0 4px 4px 0;
}

/* ==========================================================================
   Old English Character Toolbar Styles
   ========================================================================== */

.oe-charbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
    font-size: 0.85rem;
}

.oe-charbar-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.oe-char-buttons {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.oe-char-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-family: 'Junicode', 'Source Sans 3', Georgia, serif;
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    line-height: 1;
    transition: all 0.15s ease;
    user-select: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.oe-char-btn:hover {
    background: #0028a5;
    color: #ffffff;
    border-color: #0028a5;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 40, 165, 0.2);
}

.oe-char-btn:active {
    transform: translateY(0);
}

.oe-charbar-sep {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: #e2e8f0;
    margin: 0 3px;
}

/* Light/Translucent variant for hero search */
.hero-search-wrapper .oe-charbar {
    position: relative;
    z-index: 10;
    margin-top: 10px;
    justify-content: center;
}

.hero-search-wrapper .oe-charbar-label {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.hero-search-wrapper .oe-char-btn {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.5);
    color: #0028a5;
}

.hero-search-wrapper .oe-char-btn:hover {
    background: #ffffff;
    color: #0028a5;
    border-color: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
    transform: translateY(-2px);
}

/* ==========================================================================
   Clickable Sortable Table Columns & Visual Indicators
   ========================================================================== */
.sortable-column-header {
    transition: color 0.15s ease, opacity 0.15s ease;
    user-select: none;
}
.sortable-column-header:hover {
    color: #0028a5 !important;
}
.sortable-column-header:hover .sort-icon-none {
    color: #0028a5 !important;
    opacity: 1 !important;
}
.sort-icon {
    font-size: 0.75rem;
    line-height: 1;
    vertical-align: middle;
}
.bib-doi-pill,
.bib-url-pill {
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.bib-doi-pill:hover,
.bib-url-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

@media (max-width: 640px) {
    .hero-content {
        padding: 28px 18px 50px 18px;
    }
    .hero-title {
        font-size: 2rem;
    }
    .hero-search-form {
        flex-direction: column;
        gap: 8px;
        padding: 8px;
    }
    .hero-search-button {
        padding: 10px 20px;
        justify-content: center;
    }
}

/* About Page Enhanced Magazine Layout */
.about-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 36px;
    align-items: start;
    margin-bottom: 40px;
}

@media (max-width: 960px) {
    .about-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }
}

.about-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 28px 32px;
    margin-bottom: 24px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    position: relative;
    scroll-margin-top: 100px;
}

.about-section-tag {
    font-size: 0.75rem;
    font-weight: 800;
    color: #0284c7;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 4px;
}

.about-section-heading {
    color: #0028a5;
    font-size: 1.45rem;
    font-weight: 800;
    margin-top: 0;
    margin-bottom: 14px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
}

/* Timeline component */
.about-timeline {
    position: relative;
    padding-left: 28px;
    margin: 20px 0;
}

.about-timeline::before {
    content: '';
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 8px;
    width: 2px;
    background: #e2e8f0;
}

.about-timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.about-timeline-item:last-child {
    margin-bottom: 0;
}

.about-timeline-dot {
    position: absolute;
    left: -28px;
    top: 5px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #0028a5;
    box-shadow: 0 0 0 2px #dbeafe;
}

.about-timeline-dot.active {
    background: #0028a5;
    border-color: #ffffff;
    box-shadow: 0 0 0 3px #0028a5;
}

.about-timeline-year {
    font-weight: 800;
    color: #0028a5;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.about-timeline-content {
    font-size: 0.92rem;
    color: #334155;
    line-height: 1.6;
}

/* Comparison Cards */
.about-comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 20px 0;
}

@media (max-width: 680px) {
    .about-comparison-grid {
        grid-template-columns: 1fr;
    }
}

.about-compare-card {
    border-radius: 8px;
    padding: 20px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.about-compare-legacy {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-top: 4px solid #94a3b8;
}

.about-compare-modern {
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
    border-top: 4px solid #0028a5;
}

/* Quick TOC in Sidebar */
.about-toc-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: #334155;
    font-weight: 600;
    font-size: 0.88rem;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.about-toc-link:hover {
    background: #f0f7ff;
    color: #0028a5;
    border-color: #dbeafe;
    padding-left: 16px;
}

/* Copy Citation Button */
.copy-citation-btn {
    background: #0028a5;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.copy-citation-btn:hover {
    background: #001f7a;
    box-shadow: 0 2px 6px rgba(0, 40, 165, 0.25);
}




/* ==========================================================================
   UZH ASChart — Diplomatic Formula Highlighting & Interactive Controls
   ========================================================================== */
.charter-reader {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 32px;
    margin: 24px 0;
    box-shadow: 0 4px 16px rgba(0, 40, 165, 0.05);
    font-family: 'Junicode', 'Palatino', Georgia, serif;
    font-size: 1.15rem;
    line-height: 1.85;
    color: #1e293b;
}

.charter-reader p {
    margin-bottom: 1.4em;
}

/* Diplomatic Highlights */
.diplomatic-highlight {
    padding: 1px 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    display: inline;
}

.diplomatic-invocation {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #bae6fd;
}
.diplomatic-invocation .diplomatic-tag {
    background: #0284c7;
    color: #fff;
}

.diplomatic-proem {
    background: #f3e8ff;
    color: #7e22ce;
    border-color: #e9d5ff;
}
.diplomatic-proem .diplomatic-tag {
    background: #9333ea;
    color: #fff;
}

.diplomatic-dispositive {
    background: #ccfbf1;
    color: #0f766e;
    border-color: #99f6e4;
    font-weight: 600;
}
.diplomatic-dispositive .diplomatic-tag {
    background: #0d9488;
    color: #fff;
}

.diplomatic-bounds {
    background: #dcfce7;
    color: #15803d;
    border-color: #bbf7d0;
}
.diplomatic-bounds .diplomatic-tag {
    background: #16a34a;
    color: #fff;
}

.diplomatic-datingclause {
    background: #fef3c7;
    color: #b45309;
    border-color: #fde68a;
}
.diplomatic-datingclause .diplomatic-tag {
    background: #d97706;
    color: #fff;
}

.diplomatic-curse {
    background: #ffe4e6;
    color: #be123c;
    border-color: #fecdd3;
}
.diplomatic-curse .diplomatic-tag {
    background: #e11d48;
    color: #fff;
}

.diplomatic-promplace {
    background: #e0e7ff;
    color: #4338ca;
    border-color: #c7d2fe;
}
.diplomatic-promplace .diplomatic-tag {
    background: #4f46e5;
    color: #fff;
}

.diplomatic-person {
    color: #1e40af;
    font-weight: 600;
    text-decoration: underline dotted #3b82f6;
    text-underline-offset: 3px;
    transition: color 0.15s;
}
.diplomatic-person:hover {
    color: #1d4ed8;
    background: #eff6ff;
    border-radius: 2px;
}

.diplomatic-tag {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 5px;
    vertical-align: middle;
    display: inline-block;
    line-height: 1.2;
    font-family: 'Source Sans 3', sans-serif;
}

/* Toolbar for toggling formula highlights */
.formula-toggle-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 18px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 20px;
    align-items: center;
}

.formula-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 14px;
    cursor: pointer;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    transition: all 0.15s ease;
    user-select: none;
}

.formula-toggle-btn.active {
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.formula-toggle-btn.btn-inv.active { background: #e0f2fe; border-color: #0284c7; color: #0369a1; }
.formula-toggle-btn.btn-pro.active { background: #f3e8ff; border-color: #9333ea; color: #7e22ce; }
.formula-toggle-btn.btn-disp.active { background: #ccfbf1; border-color: #0d9488; color: #0f766e; }
.formula-toggle-btn.btn-bnd.active { background: #dcfce7; border-color: #16a34a; color: #15803d; }
.formula-toggle-btn.btn-dtc.active { background: #fef3c7; border-color: #d97706; color: #b45309; }
.formula-toggle-btn.btn-crs.active { background: #ffe4e6; border-color: #e11d48; color: #be123c; }
.formula-toggle-btn.btn-prm.active { background: #e0e7ff; border-color: #4f46e5; color: #4338ca; }

/* When a formula class is disabled via JS */
body.hide-inv .diplomatic-invocation { background: transparent !important; color: inherit !important; border-color: transparent !important; }
body.hide-inv .diplomatic-invocation .diplomatic-tag { display: none !important; }

body.hide-pro .diplomatic-proem { background: transparent !important; color: inherit !important; border-color: transparent !important; }
body.hide-pro .diplomatic-proem .diplomatic-tag { display: none !important; }

body.hide-disp .diplomatic-dispositive { background: transparent !important; color: inherit !important; border-color: transparent !important; font-weight: inherit !important; }
body.hide-disp .diplomatic-dispositive .diplomatic-tag { display: none !important; }

body.hide-bnd .diplomatic-bounds { background: transparent !important; color: inherit !important; border-color: transparent !important; }
body.hide-bnd .diplomatic-bounds .diplomatic-tag { display: none !important; }

body.hide-dtc .diplomatic-datingclause { background: transparent !important; color: inherit !important; border-color: transparent !important; }
body.hide-dtc .diplomatic-datingclause .diplomatic-tag { display: none !important; }

body.hide-crs .diplomatic-curse { background: transparent !important; color: inherit !important; border-color: transparent !important; }
body.hide-crs .diplomatic-curse .diplomatic-tag { display: none !important; }

body.hide-prm .diplomatic-promplace { background: transparent !important; color: inherit !important; border-color: transparent !important; }
body.hide-prm .diplomatic-promplace .diplomatic-tag { display: none !important; }

/* ==========================================================================
   Predictive Typeahead Search Dropdown (UZH Corporate Design 2.10.0 Edition)
   ========================================================================== */
.predictive-dropdown {
    position: absolute;
    z-index: 999999;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 16px 36px -4px rgba(0, 40, 165, 0.16), 0 6px 16px rgba(0, 0, 0, 0.08);
    max-height: 480px;
    overflow-y: auto;
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #0f172a;
    box-sizing: border-box;
}

.predictive-dropdown * {
    box-sizing: border-box;
}

/* Scrollbar styling */
.predictive-dropdown::-webkit-scrollbar {
    width: 6px;
}
.predictive-dropdown::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Loading & Empty States */
.pred-loading,
.pred-empty {
    padding: 16px 18px;
    font-size: 0.92rem;
    color: #64748b;
}

.pred-loading {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pred-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #e2e8f0;
    border-top-color: #0028a5;
    border-radius: 50%;
    animation: pred-spin 0.6s linear infinite;
}

@keyframes pred-spin {
    to { transform: rotate(360deg); }
}

.pred-empty-msg {
    margin: 0 0 6px 0;
    color: #475569;
}

.pred-empty-action {
    display: inline-block;
    color: #0028a5;
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
}
.pred-empty-action:hover {
    text-decoration: underline;
}

/* Group Headers */
.pred-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 6px 16px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    user-select: none;
}

.pred-group-header:first-child {
    border-top: none;
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
}

.pred-group-count {
    background: #e2e8f0;
    color: #475569;
    font-size: 0.68rem;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 700;
}

/* Suggestion Items */
.pred-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    text-decoration: none !important;
    color: inherit;
    border-bottom: 1px solid #f8fafc;
    border-left: 3px solid transparent;
    transition: background 0.12s ease, border-color 0.12s ease;
    cursor: pointer;
}

.pred-item:hover,
.pred-item.pred-active {
    background: #f0f4ff;
    border-left-color: #0028a5;
}

.pred-item-main {
    flex: 1;
    min-width: 0;
}

.pred-item-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.pred-item-title {
    font-size: 0.94rem;
    font-weight: 700;
    color: #1e293b;
}

.pred-item:hover .pred-item-title,
.pred-item.pred-active .pred-item-title {
    color: #0028a5;
}

.pred-item-sub {
    font-size: 0.82rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.pred-item-arrow {
    margin-left: 12px;
    color: #94a3b8;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.pred-item:hover .pred-item-arrow,
.pred-item.pred-active .pred-item-arrow {
    opacity: 1;
    color: #0028a5;
    transform: translateX(3px);
}

/* Type Badges */
.pred-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1px 7px;
    border-radius: 10px;
    border: 1px solid transparent;
}

.pred-badge-charter { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.pred-badge-archive { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.pred-badge-formula { background: #f3e8ff; color: #7e22ce; border-color: #e9d5ff; }
.pred-badge-person  { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.pred-badge-text    { background: #ffe4e6; color: #be123c; border-color: #fecdd3; }

/* FTS Snippet Highlight Mark */
.pred-mark {
    background: #fef08a;
    color: #854d0e;
    font-weight: 700;
    padding: 1px 3px;
    border-radius: 2px;
}

/* Footer "View all results" */
.pred-footer {
    display: block;
    padding: 11px 16px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    font-size: 0.88rem;
    font-weight: 600;
    color: #0028a5 !important;
    text-align: center;
    text-decoration: none !important;
    transition: background 0.15s ease, color 0.15s ease;
    border-bottom-left-radius: 7px;
    border-bottom-right-radius: 7px;
}

.pred-footer:hover,
.pred-footer.pred-active {
    background: #0028a5;
    color: #ffffff !important;
}

/* Submenu dropdown for UZH Main Navigation */
.uzh-nav-has-sub {
    position: relative;
}

.uzh-sub-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 8px 24px rgba(0, 40, 165, 0.14);
    z-index: 999;
    list-style: none;
    margin: 0;
    padding: 6px 0;
}

.uzh-nav-has-sub:hover .uzh-sub-nav,
.uzh-nav-has-sub:focus-within .uzh-sub-nav {
    display: block;
}

.uzh-sub-nav--item {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
}

.uzh-sub-nav--link {
    display: block !important;
    padding: 9px 18px !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    text-decoration: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
    transition: all 0.15s ease !important;
    white-space: nowrap !important;
}

.uzh-sub-nav--item:last-child .uzh-sub-nav--link {
    border-bottom: none !important;
}

.uzh-sub-nav--link:hover,
.uzh-sub-nav--link:focus {
    background: #eef2ff !important;
    color: #0028a5 !important;
    padding-left: 22px !important;
}

.uzh-sub-nav--link.active {
    background: #e0e7ff !important;
    color: #0028a5 !important;
    font-weight: 700 !important;
}



