/* Arsenali corpus — book list + document detail (modular, project-specific). */

.ars-book, .ars-chapter { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.ars-breadcrumb { font-size: .85rem; color: #555; margin: .5rem 0 1rem; }
.ars-breadcrumb .current { color: #000; font-weight: 600; }
.ars-title { font-size: 1.8rem; margin: 0 0 .5rem; }
.ars-desc { color: #333; margin-bottom: 1.5rem; }

.ars-layout { display: grid; grid-template-columns: 280px 1fr; gap: 2rem; align-items: start; }
.ars-chapter .ars-layout { grid-template-columns: 1fr 260px; }
@media (max-width: 800px) { .ars-layout { grid-template-columns: 1fr; } }

/* --- filters (book page, inside the aside) --- */
/* Flex row so the aside column stretches to the full list height: a floated
   Materialize col is only as tall as its content, leaving sticky no travel. */
.ars-row { display: flex; flex-wrap: wrap; }
/* 3rem matches p.pub_tree's padding-top, so the box tops align across columns */
.ars-filters-box { position: sticky; top: 1rem; margin-top: 3rem; }
.ars-filters-title { font-weight: 700; font-size: .9rem; text-transform: uppercase; letter-spacing: .03em; margin: 0 0 .6rem; }
.ars-filters .ars-field { margin-bottom: .9rem; }
.ars-filters label { display: block; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; margin-bottom: .3rem; }
.ars-reset { width: 100%; padding: .5rem; border: 1px solid #bbb; background: #fff; border-radius: 6px; cursor: pointer; margin-top: .4rem; }
.ars-reset:hover { background: #f0f0f0; }

/* --- facet dropdown widget (built by arsenali.js: search + checkboxes + live counts) --- */
.ars-dd { position: relative; }
.ars-dd-trigger {
    width: 100%; text-align: left; font-size: .85rem; padding: .45rem 1.6rem .45rem .6rem;
    border: 1px solid #bbb; border-radius: 6px; background: #fff; cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative;
}
.ars-dd-trigger::after {
    content: '\25BE'; position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); color: #777;
}
.ars-dd-trigger.ars-dd-active { border-color: #1a3e6e; font-weight: 600; }
.ars-dd-panel {
    position: absolute; z-index: 30; top: calc(100% + 2px); left: 0; right: 0; min-width: 100%;
    background: #fff; border: 1px solid #bbb; border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.15);
    padding: .4rem;
}
.ars-dd-search {
    width: 100%; box-sizing: border-box; font-size: .85rem; margin: 0 0 .3rem;
    padding: .3rem .5rem; border: 1px solid #ccc; border-radius: 4px;
    /* opt out of Materialize's global input styling */
    height: auto; background: #fff;
}
.ars-dd-search:focus { outline: none; border-color: #1a3e6e; box-shadow: none; }
.ars-dd-list { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow: auto; }
.ars-dd-list li[hidden] { display: none; }
.ars-dd-list label { display: flex; align-items: baseline; gap: .35rem; font-size: .85rem; color: #333; padding: .25rem .2rem; cursor: pointer; border-radius: 4px; }
.ars-dd-list label:hover { background: #f2f2f2; }
/* the native input stays hidden: Materialize draws the checkbox on the span::before */
.ars-dd-list [type=checkbox]:disabled + .ars-dd-val { color: #888; } /* locked mention in the modal */
/* Materialize fixes the row at 25px: let long values wrap in the narrow panel */
.ars-dd-list [type=checkbox] + .ars-dd-val { flex: 1; height: auto; min-height: 25px; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.ars-dd-count { color: #888; font-size: .75rem; }

/* --- results list --- */
.ars-count { font-size: .85rem; color: #666; margin: 0 0 .75rem; }
.ars-list { list-style: none; margin: 0; padding: 0; }
.ars-list li { padding: .75rem 0; border-bottom: 1px solid #eee; }
.ars-list a { text-decoration: none; color: #1a3e6e; font-weight: 600; }
.ars-list a:hover { text-decoration: underline; }
.ars-list .ars-meta { display: block; font-size: .8rem; color: #777; margin-top: .2rem; }
.ars-list .ars-tags { display: block; margin-top: .25rem; }

/* --- document header --- */
.ars-doc-head { margin-bottom: 1.5rem; }
/* small pills, deliberately much shorter than the title line height */
.ars-badge { display: inline-block; padding: 0 .45rem; border-radius: 4px; font-size: .7rem; font-weight: 600; line-height: 1.7; vertical-align: middle; margin-right: .3rem; text-transform: uppercase; letter-spacing: .03em; }
.ars-subject { background: #e4e4e4; color: #444; }
.ars-date-note { background: #757575; color: #fff; }
.ars-date-span { font-size: .85rem; color: #777; margin: .2rem 0 0; }
.ars-segnatura { font-weight: 700 !important; margin: .5rem 0 0; }

/* --- prose fragment (rendered by the source) --- */
.ars-prose { line-height: 1.6; }
.ars-prose .ecf-persona { color: #00B050; }
.ars-prose .ecf-luogo   { color: #7030A0; }
.ars-prose .ecf-carica  { color: #0070C0; }
/* inline entities open the occurrences modal (see arsenali.js) */
.ars-prose .ecf-persona, .ars-prose .ecf-luogo, .ars-prose .ecf-carica { cursor: pointer; }
.ars-prose .ecf-persona:hover, .ars-prose .ecf-luogo:hover, .ars-prose .ecf-carica:hover { text-decoration: underline; }
.ars-prose sup { font-size: .72em; line-height: 0; }
.ars-prose sup a { text-decoration: none; }

/* footnotes list at the bottom of the document */
.ars-prose .ecf-footnotes {
    margin-top: 2.5rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
    font-size: .85rem;
    color: #444;
    line-height: 1.55;
}
.ars-prose .ecf-footnotes li { margin-bottom: .4rem; }
.ars-prose .ecf-footnotes li a { text-decoration: none; }
.ars-prose .ecf-footnotes li:target { background: #fff6d6; }

/* --- images carousel (slick, init in ArsenaliChapterHome extra-js) --- */
/* fixed-height stage: with lazyLoad the image arrives after the slide change,
   so the slide must never derive its height from the (not yet loaded) image */
.ars-gallery { margin: 2rem 0 3rem; }
.ars-gallery a { display: flex; align-items: center; justify-content: center; height: 460px; }
.ars-gallery img { display: block; max-width: 100%; max-height: 460px; }
/* center mode: only .slick-center is in focus; neighbours are shrunk, blurred
   and dimmed, and act as prev/next targets (click -> slickGoTo, see extra-js) */
.ars-gallery .slick-slide { padding: 0 .4rem; box-sizing: border-box; transform: scale(.72); filter: blur(2px); opacity: .55; cursor: pointer; transition: transform .35s ease, filter .35s ease, opacity .35s ease; }
.ars-gallery .slick-slide.slick-center { transform: none; filter: none; opacity: 1; cursor: default; z-index: 1; }
.ars-gallery .slick-slide.slick-center a { cursor: zoom-in; }
.ars-gallery .slick-slide a { pointer-events: none; }
.ars-gallery .slick-slide.slick-center a { pointer-events: auto; }
.ars-gallery .slick-list { overflow: hidden; }
/* slick-theme arrows are white by default: invisible on the white page */
.ars-gallery .slick-prev:before, .ars-gallery .slick-next:before { color: #444; }

/* --- gallery lightbox (90% modal box, same page; see ArsenaliChapterHome extra-js) --- */
.ars-lightbox { border: none; padding: 1.5rem; background: #fff; border-radius: 10px; width: 90vw; height: 90vh; max-width: 90vw; max-height: 90vh; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.ars-lightbox[open] { display: flex; align-items: center; justify-content: center; }
.ars-lightbox::backdrop { background: rgba(0,0,0,.55); }
.ars-lightbox img { max-width: 100%; max-height: 100%; }
.ars-lightbox-close { position: absolute; top: .5rem; right: .8rem; border: none; background: none; color: #444; font-size: 1.8rem; line-height: 1; cursor: pointer; }
.ars-lightbox-close:hover { color: #000; }
/* prev/next inside the lightbox (mirrors the slick arrows; keyboard arrows too) */
.ars-lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 2.8rem; height: 2.8rem; border: none; border-radius: 50%; background: rgba(255,255,255,.85); color: #444; font-size: 2rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.ars-lightbox-nav:hover { color: #000; background: #fff; }
.ars-lightbox-nav:disabled { opacity: .25; cursor: default; }
.ars-lightbox-prev { left: .8rem; }
.ars-lightbox-next { right: .8rem; }
.ars-lightbox-counter { position: absolute; bottom: .5rem; left: 50%; transform: translateX(-50%); font-size: .85rem; color: #666; }

/* --- mentions sidebar --- */
/* 3rem matches p.pub_tree's padding-top (the prev/next block that used to
   provide this spacing moved under the breadcrumb) */
.ars-mentions { position: sticky; top: 1rem; margin-top: 3rem; font-size: .9rem; }
.ars-mentions h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: #666; margin: 1rem 0 .35rem; }
.ars-mentions ul { list-style: none; margin: 0; padding: 0; }
.ars-mention { background: none; border: none; padding: .1rem 0; text-align: left; cursor: pointer; color: inherit; }
.ars-mention:hover { text-decoration: underline; }
.ars-mentions h3:nth-of-type(1) ~ ul .ars-mention { }

/* --- prev/next (compact arrows under the breadcrumb, counter in between) --- */
.ars-prevnext { display: inline-flex; align-items: center; gap: .8rem; margin: .25rem 0 1rem; }
.ars-prevnext a { text-decoration: none; color: #1a3e6e; font-weight: 600; font-size: 1.25rem; line-height: 1; }
.ars-prevnext a.ars-nav-off { color: #bbb; cursor: not-allowed; }
.ars-counter { font-size: .85rem; color: #666; }

/* --- occurrences modal (filters + filtered list, see arsenali.js) --- */
/* overflow visible: the facet dropdown panels may spill past the dialog edge */
.ars-occ { border: none; border-radius: 10px; padding: 2rem; max-width: 1100px; width: 95%; overflow: visible; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.ars-occ::backdrop { background: rgba(0,0,0,.4); }
.ars-occ-close { float: right; border: none; background: none; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.ars-occ-title { margin: 0 0 1rem; font-size: 1.1rem; }
.ars-occ-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.ars-occ-filters .ars-field label { display: block; font-weight: 600; font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; margin-bottom: .25rem; }
/* grid cells are narrow: let the dropdown panel spill wider than its cell */
.ars-occ-filters .ars-dd-panel { min-width: 240px; right: auto; }
.ars-occ-filters .ars-field:last-child .ars-dd-panel { left: auto; right: 0; }
.ars-occ-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; }
.ars-occ-list li { padding: .4rem 0; border-bottom: 1px solid #eee; }
.ars-occ-list a { text-decoration: none; color: #1a3e6e; }
.ars-occ-empty { color: #777; }
.ars-occ-current { color: #555; }
.ars-occ-current-badge { background: #e4e4e4; color: #555; margin-left: .4rem; text-transform: none; letter-spacing: 0; }
