/* ---- Public research site ---- */

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* Header */
.site-head { background: var(--purple); position: sticky; top: 0; z-index: 20; }
.head-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.logo { display: inline-flex; align-items: center; }
.logo img { display: block; }
.logo .logo-mark { display: none; } /* full logo on desktop; fleur mark only on mobile (space) */
.site-head .nav-link {
    display: inline-flex; align-items: center; gap: 7px;
    color: #fff; text-decoration: none; font-weight: 700; font-size: .9rem;
    background: rgba(255,255,255,.14); padding: 8px 15px; border-radius: var(--pill);
}
.site-head .nav-link:hover { background: rgba(255,255,255,.24); }

.main { min-height: 72vh; padding-bottom: 72px; }

/* Hero */
.hero { text-align: center; padding: 56px 0 30px; }
.hero .eyebrow { font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--purple-700); }
.hero h1 { font-size: clamp(2rem, 4.4vw, 3.1rem); margin: 12px 0 12px; }
.hero p { color: var(--ink-2); font-size: 1.15rem; font-weight: 400; max-width: 46ch; margin: 0 auto 26px; }
.searchbar { position: relative; max-width: 640px; margin: 0 auto; }
.searchbar .ic { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.searchbar input {
    width: 100%; font-family: var(--font); font-size: 1.1rem; color: var(--ink);
    padding: 17px 22px 17px 52px; border-radius: var(--pill);
    border: 1.5px solid var(--line-2); background: var(--paper); box-shadow: var(--sh-2);
}
.searchbar input::placeholder { color: var(--ink-3); }
.searchbar input:focus { outline: none; border-color: var(--purple); box-shadow: var(--ring), var(--sh-2); }

.filters { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin-top: 22px; }
.chip {
    font-family: var(--font); font-size: .9rem; font-weight: 700;
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 16px; border-radius: var(--pill); border: 1.5px solid var(--line-2);
    background: var(--paper); color: var(--ink-2); cursor: pointer;
}
.chip .ic { color: var(--c, var(--ink-3)); }
.chip:hover { border-color: var(--purple-200); }
.chip.on { background: var(--purple); border-color: var(--purple); color: #fff; }
.chip.on .ic { color: #fff; }

.result-count { color: var(--ink-3); font-size: .92rem; font-weight: 600; margin: 30px 4px 16px; }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(224px, 1fr)); gap: 22px; }
.card {
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg);
    overflow: hidden; text-decoration: none; color: var(--ink);
    display: flex; flex-direction: column; box-shadow: var(--sh-1);
    transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--sh-2); border-color: var(--line-2); }
.card-img { aspect-ratio: 4 / 3; background: var(--bg-2); overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--cw); color: var(--c); }
.card-body { padding: 14px 16px 18px; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: .7rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--c); }
.card-body h2, .card-body h3 { font-size: 1.02rem; font-weight: 800; margin: 8px 0 8px; line-height: 1.3; }
.card-body .ref { font-size: .78rem; font-weight: 700; color: var(--ink-3); letter-spacing: .02em; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--ink-3); padding: 70px 20px; font-size: 1.05rem; }

/* Item detail */
.backlink { display: inline-flex; align-items: center; gap: 6px; margin: 30px 0 6px; color: var(--purple-700); text-decoration: none; font-weight: 700; font-size: .92rem; }
.backlink:hover { text-decoration: underline; }
/* Cataloguer toolbar on a record: back link left, Edit action right (only shown
   to signed-in team members who can update the item). */
.detail-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.edit-record { display: inline-flex; align-items: center; gap: 7px; margin: 30px 0 6px; padding: 8px 15px; border-radius: var(--pill); background: var(--purple-050); border: 1.5px solid var(--purple-200); color: var(--purple-700); text-decoration: none; font-weight: 700; font-size: .9rem; }
.edit-record:hover { background: var(--purple-100); }
.edit-record .ic { flex: none; }
.detail { display: grid; gap: 40px; padding: 20px 0 40px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .detail { grid-template-columns: 1.05fr 1fr; align-items: start; } }
.gallery { display: flex; flex-direction: column; gap: 12px; }
.gallery .main-img { width: 100%; border-radius: var(--r-lg); border: 1px solid var(--line); display: block; background: var(--bg-2); }
.gallery .ph-large { aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; border-radius: var(--r-lg); background: var(--cw); color: var(--c); }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); cursor: pointer; transition: outline-color .12s ease; outline: 2px solid transparent; outline-offset: 1px; }
.thumbs img:hover { border-color: var(--purple-200); }
.thumbs img.is-active { outline-color: var(--purple); }
.detail h1 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); margin: 8px 0 6px; }
.detail .ref { font-weight: 700; color: var(--ink-3); letter-spacing: .02em; }
.detail p.desc { font-size: 1.08rem; color: var(--ink-2); margin: 18px 0; font-weight: 400; }
.detail p.desc strong { font-weight: 700; color: var(--ink); }
.facts { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; margin: 20px 0 26px; background: var(--paper); }
.facts .row { display: grid; grid-template-columns: minmax(96px, 32%) 1fr; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: .96rem; }
.facts .row:last-child { border-bottom: none; }
.facts .k { color: var(--ink-3); }
.facts .v { font-weight: 700; }

/* Footer */
.site-foot { border-top: 1px solid var(--line); background: var(--paper); margin-top: 20px; }
.foot-inner { display: flex; align-items: center; gap: 16px; padding: 28px 24px; }
.foot-mark { display: block; opacity: .9; }
.site-foot p { margin: 0; color: var(--ink-2); font-weight: 700; font-size: .95rem; }
.site-foot p span { color: var(--ink-3); font-weight: 400; }


/* ---- Advanced search ---------------------------------------------------- */
.advanced { max-width: 760px; margin: 22px auto 0; text-align: center; }
.adv-toggle {
    font-family: var(--font); font-size: .9rem; font-weight: 700; cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 18px; border-radius: var(--pill); border: 1.5px solid var(--line-2);
    background: var(--paper); color: var(--ink-2);
}
.adv-toggle:hover { border-color: var(--purple-200); }
.adv-toggle .caret { display: inline-flex; transition: transform .18s ease; }
.adv-toggle .caret.flip { transform: rotate(180deg); }
.adv-badge {
    display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 999px; background: var(--purple); color: #fff; font-size: .72rem; font-weight: 800;
}
.adv-panel {
    margin-top: 14px; text-align: left; background: var(--paper);
    border: 1.5px solid var(--line-2); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--sh-2);
}
.adv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.adv-field { display: flex; flex-direction: column; gap: 6px; }
.adv-flabel { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.adv-field select {
    font-family: var(--font); font-size: 1rem; font-weight: 600; color: var(--ink);
    padding: 12px 14px; border-radius: var(--r); border: 1.5px solid var(--line-2); background: var(--bg-2);
    appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237413DC' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px;
}
.adv-field select:focus { outline: none; border-color: var(--purple); box-shadow: var(--ring); }
.adv-reset {
    margin-top: 16px; background: none; border: none; color: var(--purple-700);
    font-family: var(--font); font-weight: 700; font-size: .88rem; cursor: pointer; text-decoration: underline;
}

/* ---- Active-filter chips ------------------------------------------------ */
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 760px; margin: 20px auto 0; }
.af-label { font-size: .85rem; font-weight: 700; color: var(--ink-3); }
.af-chip {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    font-family: var(--font); font-size: .85rem; font-weight: 700; color: var(--purple-700);
    padding: 6px 12px; border-radius: var(--pill); border: 1.5px solid var(--purple-100); background: var(--purple-050);
}
.af-chip:hover { border-color: var(--purple); }
.af-clear { background: none; border: none; color: var(--ink-3); font-family: var(--font); font-weight: 700; font-size: .82rem; cursor: pointer; text-decoration: underline; }

/* ---- Pager -------------------------------------------------------------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 40px 0 8px; }
.pager-btn {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    font-family: var(--font); font-size: .9rem; font-weight: 700; color: var(--ink);
    padding: 10px 18px; border-radius: var(--pill); border: 1.5px solid var(--line-2); background: var(--paper);
}
.pager-btn:hover:not([disabled]) { border-color: var(--purple-200); color: var(--purple-700); }
.pager-btn[disabled] { opacity: .4; cursor: default; }
.pager-info { font-size: .88rem; font-weight: 700; color: var(--ink-3); }

.private-banner { display: flex; align-items: center; gap: 9px; margin: 0 0 20px; padding: 12px 16px; border-radius: var(--r); background: var(--warn-wash); border: 1.5px solid var(--warn-line); color: var(--warn); font-weight: 600; font-size: .92rem; }
.private-banner .ic { flex: none; }

/* ---- CMS additions: footer links, info pages, tags, collections ---- */
.foot-links { display:flex; flex-wrap:wrap; gap:6px 16px; margin-top:12px; }
.foot-links a { color:#fff; opacity:.85; text-decoration:none; font-size:.9rem; }
.foot-links a:hover { opacity:1; text-decoration:underline; }
.info-page h1 { margin-bottom:.6em; }
.info-page p { margin:0 0 1em; line-height:1.7; color:var(--ink-2, #4C4459); }
.item-tags { display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; }
.item-tag { display:inline-flex; align-items:center; gap:5px; padding:5px 12px; border-radius:999px;
  background:var(--purple-050,#F4EDFC); color:var(--purple-700,#560DA6); font-weight:700; font-size:.85rem; text-decoration:none; }
.item-tag:hover { background:var(--purple-100,#E9DCFA); }
.item-collections { margin-top:14px; display:flex; flex-wrap:wrap; gap:8px; }
.item-collections a { display:inline-flex; align-items:center; gap:6px; padding:6px 12px; border-radius:10px;
  border:1px solid var(--line-2,#DED5EC); color:var(--purple-700,#560DA6); text-decoration:none; font-weight:700; font-size:.88rem; }

/* ---- Tap targets (min ~44px hit area, helps older/touch users) ---- */
.site-head .nav-link { min-height: 40px; }
.chip { min-height: 42px; }
.af-chip, .item-tag { min-height: 38px; }
.pager-btn { min-height: 44px; }

/* ---- Mobile reflow: header must not overlap the logo; footer stacks ---- */
@media (max-width: 640px) {
  .head-inner { height: auto; min-height: 56px; padding: 10px 24px; gap: 8px; flex-wrap: nowrap; }
  .logo .logo-full { display: none; }
  .logo .logo-mark { display: block; height: 26px; }
  .site-head nav { display: flex; gap: 6px; flex: none; min-width: 0; }
  .site-head .nav-link { padding: 8px 12px; font-size: .82rem; gap: 5px; white-space: nowrap; }
  .foot-inner { flex-direction: column; align-items: flex-start; gap: 10px; text-align: left; }
  .hero { padding: 34px 0 24px; }
}

/* ---- UX audit: gallery buttons, lightbox, related, accent chip hover ---- */
.thumb-btn { padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); background: none; cursor: pointer; line-height: 0; outline: 2px solid transparent; outline-offset: 1px; transition: outline-color .12s ease, border-color .12s ease; }
.thumb-btn img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--r-sm); display: block; }
.thumb-btn:hover { border-color: var(--purple-200); }
.thumb-btn.is-active { outline-color: var(--purple); }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(20,12,36,.86); display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: var(--r); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox-close { position: fixed; top: 14px; right: 18px; width: 48px; height: 48px; border-radius: 50%; border: none; background: rgba(255,255,255,.16); color: #fff; font-size: 1.8rem; line-height: 1; cursor: pointer; }
.lightbox-close:hover { background: rgba(255,255,255,.3); }
.related { margin: 24px 0 40px; }
.related-h { font-size: 1.3rem; margin: 0 0 16px; }
.chip:hover { border-color: var(--c, var(--purple-200)); }
.chip.on:hover { border-color: var(--purple); }

/* Info-page prose (Markdown output) */
.info-page h2 { font-size: 1.3rem; margin: 1.4em 0 .5em; }
.info-page h3 { font-size: 1.1rem; margin: 1.2em 0 .4em; }
.info-page ul, .info-page ol { margin: 0 0 1em; padding-left: 1.4em; line-height: 1.7; color: var(--ink-2); }
.info-page li { margin: .3em 0; }
.info-page a { color: var(--purple-700); text-underline-offset: 2px; }
.info-page strong { color: var(--ink); }
.info-page blockquote { border-left: 3px solid var(--purple-200); margin: 1em 0; padding: .2em 0 .2em 1em; color: var(--ink-2); }

/* ---- Print: give archivists a clean paper copy of a record (no chrome) ---- */
@media print {
    .site-head, .site-foot, .backlink, .edit-record, .related, .lightbox, .thumbs,
    .skip-link, .pager, #wy-bar, #wy-toast, .private-banner { display: none !important; }
    html, body, .app, .main { background: #fff !important; color: #000 !important; }
    .main { max-width: 100% !important; padding: 0 !important; }
    /* Stack the image above the details rather than side-by-side. */
    .detail { display: block !important; }
    .detail .gallery { margin: 0 0 14px; }
    .main-img { max-width: 68% !important; height: auto; border: 1px solid #ccc; }
    h1 { font-size: 20pt; margin: 0 0 2pt; }
    .ref { color: #333 !important; }
    .facts { border-top: 1px solid #999; }
    .facts .row { break-inside: avoid; border-bottom: 1px solid #ccc; }
    .facts .k { color: #333 !important; }
    a { color: #000 !important; text-decoration: none; }
    .tag, .item-tag, .item-collections a { color: #000 !important; background: none !important; border: 1px solid #999 !important; }
    /* Show the permanent URL after the reference so a printout is traceable. */
    .ref::after { content: " · " attr(data-url); color: #666; font-weight: 400; }
}

/* ==== Browse view toggle (tiles / list) ==================================
   Same segmented icon control as the catalogue records page. */
.list-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 30px 0 16px; }
.list-tools .result-count { margin: 0; }
.view-toggle { display: inline-flex; flex: none; background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.vt-btn { display: grid; place-items: center; width: 44px; height: 38px; border: 0; background: none; color: var(--ink-3); cursor: pointer; }
.vt-btn + .vt-btn { border-left: 1.5px solid var(--line); }
.vt-btn:hover { background: var(--purple-050); color: var(--purple-700); }
.vt-btn.on { background: var(--purple); color: #fff; }
.vt-btn.on:hover { background: var(--purple-700); }

/* List view: one row per item, keeping the type accent bar on the left */
.row-list { display: flex; flex-direction: column; gap: 10px; }
.p-row { display: flex; align-items: center; gap: 14px; background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--c, var(--purple)); border-radius: var(--r); padding: 10px 14px 10px 12px; text-decoration: none; color: inherit; box-shadow: var(--sh-1); }
.p-row:hover { border-color: var(--line-2); box-shadow: var(--sh-2); }
.p-row .thumb { width: 56px; height: 56px; border-radius: var(--r-sm); object-fit: cover; flex: none; background: var(--bg-2); }
.p-row .thumb-ph { width: 56px; height: 56px; border-radius: var(--r-sm); flex: none; display: grid; place-items: center; background: var(--cw, var(--purple-050)); color: var(--c, var(--purple)); }
.p-row .meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.p-row .ttl { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-row .sub { font-size: .8rem; color: var(--ink-3); font-weight: 600; }
.p-row .go { color: var(--ink-3); flex: none; }
@media (max-width: 640px) { .p-row .ttl { white-space: normal; } }

/* ---- Search upgrades: autocomplete, tips, sort, snippets, did-you-mean ---- */
.search-wrap { position: relative; max-width: 640px; margin: 0 auto; }
.suggest {
    position: absolute; z-index: 30; left: 14px; right: 14px; top: calc(100% + 6px);
    margin: 0; padding: 6px; list-style: none; text-align: left;
    background: var(--paper); border: 1.5px solid var(--line-2); border-radius: var(--r); box-shadow: var(--sh-2);
}
.suggest li button {
    display: flex; align-items: center; gap: 10px; width: 100%; cursor: pointer; text-align: left;
    font-family: var(--font); font-size: .95rem; font-weight: 600; color: var(--ink-2);
    background: none; border: 0; border-radius: 8px; padding: 9px 12px;
}
.suggest li button .ic { color: var(--ink-3); flex: none; }
.suggest li button:hover, .suggest li.active button { background: rgba(116, 19, 220, .08); color: var(--purple-700); }

.tips { max-width: 640px; margin: 12px auto 0; text-align: left; }
.tips summary {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
    font-size: .84rem; font-weight: 700; color: var(--ink-3);
}
.tips summary::-webkit-details-marker { display: none; }
.tips summary::before { content: "?"; display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid currentColor; font-size: .68rem; font-weight: 800; }
.tips summary:hover { color: var(--purple-700); }
.tips ul {
    margin: 10px 0 0; padding: 14px 16px; list-style: none;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px 20px;
    background: var(--paper); border: 1.5px solid var(--line-2); border-radius: var(--r); box-shadow: var(--sh-2);
    font-size: .86rem; color: var(--ink-2);
}
.tips code {
    font-size: .82rem; font-weight: 700; color: var(--purple-700);
    background: rgba(116, 19, 220, .07); border-radius: 5px; padding: 1px 6px;
}

.tools-right { display: flex; align-items: center; gap: 12px; flex: none; }
.sort-ctl { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 700; color: var(--ink-3); }
.sort-ctl select {
    font-family: var(--font); font-size: .88rem; font-weight: 700; color: var(--ink);
    padding: 8px 30px 8px 12px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--paper);
    appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237413DC' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
    background-repeat: no-repeat; background-position: right 9px center;
}
.sort-ctl select:focus { outline: none; border-color: var(--purple); box-shadow: var(--ring); }

.adv-field input[type="number"] {
    font-family: var(--font); font-size: 1rem; font-weight: 600; color: var(--ink);
    padding: 12px 14px; border-radius: var(--r); border: 1.5px solid var(--line-2); background: var(--bg-2);
}
.adv-field input[type="number"]:focus { outline: none; border-color: var(--purple); box-shadow: var(--ring); }

mark { background: rgba(255, 200, 45, .45); color: inherit; border-radius: 3px; padding: 0 1px; }
.snip { font-size: .84rem; font-weight: 500; color: var(--ink-2); line-height: 1.45; }
.card-body .snip { margin: 8px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.p-row .snip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 3px; }

.dym { margin: 14px 0 0; font-size: .95rem; }
.dym-btn {
    background: none; border: none; cursor: pointer; padding: 0;
    font-family: var(--font); font-size: .95rem; font-weight: 800; color: var(--purple-700); text-decoration: underline;
}
.dym-btn:hover { color: var(--purple); }

@media (max-width: 640px) {
    .list-tools { flex-wrap: wrap; }
    .tools-right { width: 100%; justify-content: space-between; }
}
