/* ============================================================================
   BHR.CSS — Bibliotheca Hertziana shared design system
   Used by: ocr-list.html, textsearch.html, indexsearch.html, index.html
   ============================================================================ */

/* ── Fonts ──────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Libre+Franklin:wght@300;400;500;600;700&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap');

/* ── Design tokens ──────────────────────────────────────────────────────── */

:root {
    --navy:         #0d2046;
    --navy-mid:     #163060;
    --navy-light:   #1e3f7a;
    --accent:       #c8102e;
    --accent-hover: #a50d25;
    --bg:           #f2f4f7;
    --surface:      #ffffff;
    --border:       #d4d9e3;
    --text:         #1a1f2e;
    --text-muted:   #5a6278;
    --row-hover:    #eef1f8;
    --font-ui:      'Libre Franklin', sans-serif;
    --font-serif:   'Libre Baskerville', serif;

    /* Spacing & geometry — used by map panel */
    --spacing-sm:     0.5rem;
    --spacing-md:     1rem;
    --spacing-lg:     2rem;
    --border-radius:  4px;
    --shadow-panel:   0 0 10px 2px rgba(0, 0, 0, 0.1);

    /* Page width — one knob for every list/search page.
       Override per page with  .page { --page-max: … }  if needed. */
    --page-max:       1600px;
    --page-gutter:    clamp(1rem, 3vw, 3rem);
}

/* ── Reset ──────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-ui);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────────────────────── */

header {
    background: var(--navy);
    padding: 0 2.5rem;
    display: flex;
    align-items: stretch;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,.35);
}

/* Logo slot — wraps the favicon + text block */
.logo-slot {
    display: flex;
    align-items: center;
    min-width: 220px;
    border-right: 1px solid rgba(255,255,255,.12);
    margin-right: 2rem;
    padding-right: 2rem;
    text-decoration: none;   /* when logo-slot is an <a> */
}

.logo-name {
    display: block;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: .78rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255,255,255,.95);
    line-height: 1.2;
}

.logo-sub {
    display: block;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: .72rem;
    color: rgba(255,255,255,.5);
    letter-spacing: .02em;
    line-height: 1.35;
}

/* index.html uses .header-logo instead of .logo-slot */
.header-logo {
    display: flex;
    align-items: center;
    min-width: 220px;
    border-right: 1px solid rgba(255,255,255,.12);
    margin-right: 2rem;
    padding-right: 2rem;
    text-decoration: none;
}

.header-logo strong {
    display: block;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: .78rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255,255,255,.95);
    line-height: 1.2;
}

.header-logo span {
    display: block;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: .72rem;
    color: rgba(255,255,255,.5);
    letter-spacing: .02em;
    line-height: 1.3;
}

/* Navigation */
nav {
    display: flex;
    align-items: center;
    gap: .25rem;
    flex: 1;
}

nav a {
    color: rgba(255,255,255,.6);
    text-decoration: none;
    font-family: var(--font-ui);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 0 1rem;
    height: 56px;
    display: flex;
    align-items: center;
    border-bottom: 3px solid transparent;
    transition: color .15s, border-color .15s;
}

nav a:hover  { color: #fff; border-color: rgba(255,255,255,.3); }
nav a.active { color: #fff; border-color: var(--accent); }

/* ── Page shell ─────────────────────────────────────────────────────────── */

.page {
    max-width: calc(var(--page-max) + 2 * var(--page-gutter));
    margin: 0 auto;
    padding: 2rem var(--page-gutter) 4rem;
}

.page-title {
    margin-bottom: 1.8rem;
}

.page-title h1 {
    font-family: var(--font-serif);
    font-size: 1.55rem;
    font-weight: 400;
    color: var(--navy);
    margin-bottom: .35rem;
}

.page-title .subtitle {
    font-size: .85rem;
    color: var(--text-muted);
}

/* ── Card ────────────────────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    overflow: hidden;
}

/* ── Search card (textsearch / indexsearch) ─────────────────────────────── */

.search-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    padding: 1.4rem 1.5rem;
    margin-bottom: 1.5rem;
}

.search-row   { display: flex; gap: .75rem; align-items: center; }

.search-label {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}

.search-input-wrap { position: relative; flex: 1; }

.search-input-wrap svg {
    position: absolute;
    left: .9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    width: 16px; height: 16px;
}

#searchBox {
    width: 100%;
    padding: .65rem 1rem .65rem 2.6rem;
    border: 1.5px solid var(--border);
    border-radius: 3px;
    font-family: var(--font-ui);
    font-size: .9rem;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

#searchBox:focus {
    border-color: var(--navy-light);
    box-shadow: 0 0 0 3px rgba(30,63,122,.15);
}

#searchBox::placeholder { color: var(--text-muted); }

#searchButton {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .65rem 1.4rem;
    background: var(--navy);
    color: #fff;
    border: 1.5px solid var(--navy);
    border-radius: 3px;
    font-family: var(--font-ui);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .13s, border-color .13s;
    white-space: nowrap;
}

#searchButton:hover {
    background: var(--navy-light);
    border-color: var(--navy-light);
}

/* ── DataTables — shared overrides ──────────────────────────────────────── */

.dataTables_wrapper { padding: 0; font-family: var(--font-ui); }

/* always hide the built-in search box */
.dataTables_filter { display: none !important; }

.dataTables_length {
    padding: .65rem 1.5rem !important;
    font-size: .78rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.dataTables_length select {
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: .2rem .5rem;
    font-family: var(--font-ui);
    font-size: .78rem;
    color: var(--text);
    background: var(--surface);
    margin: 0 .35rem;
}

.dataTables_info {
    padding: .85rem 1.5rem !important;
    font-size: .78rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

.dataTables_paginate {
    padding: .75rem 1.5rem !important;
    border-top: 1px solid var(--border);
}

.dataTables_info + .dataTables_paginate { border-top: none; }

.dataTables_wrapper .bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border);
}

/* Pagination buttons */
.paginate_button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 .5rem !important;
    margin: 0 2px !important;
    border: 1px solid var(--border) !important;
    border-radius: 3px !important;
    font-size: .78rem !important;
    font-family: var(--font-ui) !important;
    color: var(--navy) !important;
    background: var(--surface) !important;
    cursor: pointer;
    transition: background .12s, color .12s;
}

.paginate_button:hover:not(.disabled):not(.current) {
    background: var(--row-hover) !important;
    color: var(--navy) !important;
}

.paginate_button.current {
    background: var(--navy) !important;
    color: #fff !important;
    border-color: var(--navy) !important;
    font-weight: 600 !important;
}

.paginate_button.disabled { opacity: .35 !important; cursor: default !important; }

/* ── Table ───────────────────────────────────────────────────────────────── */

table.dataTable {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 0 !important;
}

table.dataTable thead th {
    background: var(--navy);
    color: rgba(255,255,255,.85);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: .9rem 1.25rem !important;
    border-bottom: none !important;
    white-space: nowrap;
    text-align: left !important;
}

table.dataTable thead th:first-child { padding-left: 1.5rem !important; }
table.dataTable thead th:last-child  { padding-right: 1.5rem !important; }

table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after { opacity: .5; }
table.dataTable thead .sorting_asc::after  { opacity: 1; }
table.dataTable thead .sorting_desc::after { opacity: 1; }

table.dataTable tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .1s;
}

table.dataTable tbody tr:last-child { border-bottom: none; }
table.dataTable tbody tr:hover      { background: var(--row-hover) !important; }
table.dataTable tbody tr.odd        { background: var(--surface); }
table.dataTable tbody tr.even       { background: #fafbfd; }

table.dataTable tbody td {
    padding: .85rem 1.25rem !important;
    font-size: .875rem;
    vertical-align: top;
    border-top: none !important;
    color: var(--text);
    line-height: 1.55;
}

table.dataTable tbody td:first-child { padding-left: 1.5rem !important; }
table.dataTable tbody td:last-child  { padding-right: 1.5rem !important; }

/* ── Cell types (search pages) ──────────────────────────────────────────── */

.col-year {
    font-size: .82rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.col-link a {
    color: var(--navy-light);
    text-decoration: none;
    font-family: var(--font-serif);
    font-size: .87rem;
    line-height: 1.45;
}

.col-link a:hover { color: var(--navy); text-decoration: underline; }

/* Highlighted search term */
strong.hl,
.search-highlight {
    background: #fff3c4;
    color: var(--text);
    font-weight: 600;
    padding: 1px 3px;
    border-radius: 2px;
}
/* ============================================================================
   MOBILE — shared responsive overrides (≤ 768 px)
   ============================================================================ */

@media (max-width: 768px) {

    /* ── Header ────────────────────────────────────────────────────────────── */

    header {
        padding: 0 1rem;
        height: 48px;
    }

    /* Hide the text block next to the logo; keep only the icon */
    .logo-slot div,
    .header-logo div { display: none; }

    /* Shrink the logo container — no divider, no excess spacing */
    .logo-slot,
    .header-logo {
        min-width: 0;
        border-right: none;
        margin-right: 0;
        padding-right: .75rem;
    }

    nav { gap: 0; }

    nav a {
        padding: 0 .6rem;
        font-size: .68rem;
        letter-spacing: .06em;
        height: 48px;
    }

    /* ── Page shell ────────────────────────────────────────────────────────── */

    .page { padding: 1.5rem 1rem 3rem; }

    .page-title { margin-bottom: 1.25rem; }

    .page-title h1 {
        font-size: 1.2rem;
        line-height: 1.35;
    }

    .page-title .subtitle { font-size: .8rem; }

    /* ── Search card ───────────────────────────────────────────────────────── */

    .search-card { padding: 1rem; }

    .search-row {
        flex-direction: column;
        align-items: stretch;
        gap: .6rem;
    }

    /* Label above the input, less prominent */
    .search-label { font-size: .68rem; }

    #searchBox { font-size: .85rem; }

    #searchButton {
        width: 100%;
        justify-content: center;
        padding: .7rem 1rem;
    }

    /* ── Card / table wrapper — enable horizontal scroll ───────────────────── */

    /* .card already has overflow:hidden — override so the table can scroll */
    .card { overflow-x: auto; }

    /* Tighter cell padding on small screens */
    table.dataTable tbody td {
        padding: .6rem .75rem !important;
        font-size: .82rem;
    }

    table.dataTable tbody td:first-child { padding-left: 1rem !important; }
    table.dataTable tbody td:last-child  { padding-right: 1rem !important; }

    table.dataTable thead th {
        padding: .65rem .75rem !important;
        font-size: .68rem;
    }

    table.dataTable thead th:first-child { padding-left: 1rem !important; }
    table.dataTable thead th:last-child  { padding-right: 1rem !important; }

    /* ── DataTables chrome ─────────────────────────────────────────────────── */

    .dataTables_length { display: none !important; }   /* never useful on mobile */

    .dataTables_info,
    .dataTables_paginate { padding: .65rem 1rem !important; }

    .dataTables_wrapper .bottom { flex-direction: column; align-items: flex-start; gap: .25rem; }

    /* Smaller pagination buttons */
    .paginate_button {
        min-width: 26px !important;
        height: 26px !important;
        font-size: .72rem !important;
    }

    /* ── ocr-list specific ─────────────────────────────────────────────────── */

    /* Global search bar fills the width */
    #global-search { max-width: 100%; font-size: .85rem; }

}
/* ============================================================================
   ABOUT PANEL — drops down from the header nav
   ============================================================================ */

#about-panel {
    display: none;
    position: fixed;
    top: 56px;              /* flush below the fixed header */
    left: 0; right: 0;
    z-index: 190;
    justify-content: flex-start;  /* panel hugs the left after the nav */
}

#about-panel.open { display: flex; }

#about-panel-inner {
    position: relative;
    background: var(--navy);
    color: rgba(255,255,255,.85);
    max-width: 480px;
    padding: 2rem 2rem 1.75rem;
    box-shadow: 0 8px 32px rgba(0,0,0,.35);
    border-top: 2px solid var(--accent);
    /* nudge it to sit under the About link in the nav */
    margin-left: 310px;   /* logo-slot ~220px + Books + Hub links ~2×45px */
}

#about-panel-inner h2 {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1rem;
    letter-spacing: .03em;
}

#about-panel-inner p {
    font-size: .82rem;
    line-height: 1.7;
    color: rgba(255,255,255,.78);
    margin-bottom: .85rem;
}

#about-panel-inner p:last-child { margin-bottom: 0; }

#about-panel-inner a {
    font-size: .82rem;
    color: rgba(255,255,255,.95);
    text-underline-offset: 2px;
}

#about-panel-inner a:hover { color: #fff; }

#about-close {
    position: absolute;
    top: .75rem; right: .85rem;
    background: none;
    border: none;
    color: rgba(255,255,255,.5);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: .1rem .3rem;
    transition: color .13s;
}

#about-close:hover { color: #fff; }

@media (max-width: 768px) {
    #about-panel-inner {
        margin-left: 0;
        max-width: 100%;
        width: 100%;
    }
}