/* Container */
    .ipll{width:100%;max-width:100%;box-sizing:border-box}
    .ipll *{box-sizing:border-box}
    .ipll-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

    /* TOOLBAR - proportional flex sizing
       search: grows the most (flex-grow: 2)
       sort:   smaller fixed-ish width
       toggle: natural width */
    .ipll-toolbar{
        display:flex;
        align-items:center;
        gap:12px;
        margin-bottom:20px;
        width:100%;
        flex-wrap:wrap;
    }
    .ipll-search-box{
        position:relative;
        flex:2 1 280px;
        min-width:0;
    }
    .ipll-search-ico{
        position:absolute;
        left:14px;
        top:50%;
        transform:translateY(-50%);
        width:16px;
        height:16px;
        color:#888;
        pointer-events:none;
        z-index:1;
    }
    .ipll-search{
        width:100%;
        height:42px;
        padding:0 14px 0 34px !important;
        border:1px solid #ddd;
        border-radius:6px;
        font-size:14px;
        background-color:#fff;
        color:#333;
        transition:border-color .15s,box-shadow .15s;
    }
    .ipll-search:focus{outline:none;border-color:#0073aa;box-shadow:0 0 0 2px rgba(0,115,170,.15)}
    .ipll-search::-webkit-search-decoration,
    .ipll-search::-webkit-search-cancel-button{-webkit-appearance:none}

    .ipll-sort,
    .ipll-catsel{
        flex:1 1 160px;
        min-width:140px;
        max-width:200px;
        height:42px;
        padding:0 34px 0 14px;
        border:1px solid #ddd;
        border-radius:6px;
        font-size:14px;
        background-color:#fff;
        background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath stroke='%23666' stroke-width='1.5' fill='none' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
        background-repeat:no-repeat;
        background-position:right 10px center;
        background-size:14px;
        color:#333;
        -webkit-appearance:none;
        appearance:none;
        cursor:pointer;
        transition:border-color .15s,box-shadow .15s;
    }
    .ipll-sort:focus,
    .ipll-catsel:focus{outline:none;border-color:#0073aa;box-shadow:0 0 0 2px rgba(0,115,170,.15)}

    /* VIEW TOGGLE - robust icon handling for <i>, <svg>, and <img> */
    .ipll-toggle{
        display:flex;
        flex:0 0 auto;
        background-color:#f0f0f0;
        border-radius:8px;
        padding:4px;
    }
    .ipll-tog-btn{
        display:inline-flex;
        align-items:center;
        justify-content:center;
        width:36px;
        height:36px;
        border:0;
        background-color:transparent;
        border-radius:6px;
        cursor:pointer;
        color:#666;
        padding:0;
        margin:0;
        line-height:1;
        font-size:0;
        transition:background-color .15s,color .15s;
    }
    .ipll-tog-btn:hover{background-color:rgba(0,0,0,.06)}
    .ipll-tog-btn:focus-visible{outline:2px solid #0073aa;outline-offset:1px}
    .ipll-tog-btn[aria-pressed="true"]{background-color:#0073aa;color:#fff}

    /* Icon inside toggle: covers Font Awesome <i>, inline <svg>, and uploaded <img> */
    .ipll-tog-btn i{font-size:16px;line-height:1;color:inherit}
    .ipll-tog-btn svg{width:16px;height:16px;display:block;fill:currentColor}
    .ipll-tog-btn img{width:16px;height:16px;display:block;object-fit:contain}
    /* For <img>-rendered uploaded SVG (custom upload), invert color on active state */
    .ipll-tog-btn[aria-pressed="true"] img{filter:brightness(0) invert(1)}
    /* Catch wrapped icons (Elementor sometimes wraps in <span>) */
    .ipll-tog-btn span{display:inline-flex;align-items:center;justify-content:center;line-height:1}

    /* LIST VIEW */
    .ipll-list{display:flex;flex-direction:column;gap:10px}
    .ipll-item{display:flex;align-items:center;gap:16px;padding:16px 20px;background-color:#fff;border:1px solid #e5e5e5;border-radius:8px;transition:background-color .15s,border-color .15s,box-shadow .15s}
    .ipll-item:hover{background-color:#fafafa;box-shadow:0 2px 8px rgba(0,0,0,.06)}
    .ipll-pdf-icon{flex-shrink:0;line-height:1;color:#e74c3c;display:inline-flex;align-items:center;justify-content:center}
    .ipll-pdf-icon i{font-size:32px;color:inherit;line-height:1}
    .ipll-pdf-icon svg{width:32px;height:32px;fill:currentColor}
    .ipll-pdf-icon img{width:32px;height:32px;object-fit:contain}
    .ipll-info{flex:1;min-width:0}
    .ipll-title{margin-bottom:3px}
    .ipll-title a{color:#222;text-decoration:none;font-weight:600;font-size:15px;transition:color .15s}
    .ipll-title a:hover{color:#0073aa}
    .ipll-meta{color:#777;font-size:13px}
    .ipll-btns{display:flex;gap:8px;flex-shrink:0}

    /* BUTTONS */
    .ipll-btn{display:inline-flex;align-items:center;justify-content:center;padding:9px 18px;border-radius:5px;font-size:13px;font-weight:500;text-decoration:none;border:0;cursor:pointer;transition:background-color .15s,color .15s}
    .ipll-btn-view{background-color:#0073aa;color:#fff}
    .ipll-btn-view:hover{background-color:#005a87;color:#fff}
    .ipll-btn-dl{background-color:#27ae60;color:#fff}
    .ipll-btn-dl:hover{background-color:#1e8449;color:#fff}
    .ipll-btn-ico{padding:8px;border-radius:50%;width:32px;height:32px}
    .ipll-btn-ico svg{width:16px;height:16px;display:block}

    /* GRID VIEW */
    .ipll-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px}
    .ipll-card{position:relative;background-color:#fff;border:1px solid #e5e5e5;border-radius:10px;overflow:hidden;box-shadow:0 2px 8px rgba(0,0,0,.06);transition:box-shadow .2s,transform .2s,border-color .2s}
    .ipll-card:hover{box-shadow:0 6px 20px rgba(0,0,0,.1);transform:translateY(-2px)}
    .ipll-card-link{display:block;text-decoration:none;color:inherit}
    .ipll-preview{height:200px;background:linear-gradient(135deg,#f5f5f5,#eaeaea);display:flex;align-items:center;justify-content:center;position:relative;overflow:hidden}
    .ipll-loader{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:inherit;z-index:2}
    .ipll-loader.hide{display:none}
    .ipll-spin{width:24px;height:24px;color:#888;animation:ipll-spin 1s linear infinite}
    @keyframes ipll-spin{to{transform:rotate(360deg)}}
    .ipll-canvas{max-width:100%;max-height:100%;object-fit:contain;display:none}
    .ipll-canvas.show{display:block}
    .ipll-fb{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;color:#aaa}
    .ipll-fb.hide{display:none}
    .ipll-fb svg{width:40px;height:40px}
    .ipll-fb span{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.5px}
    .ipll-card-info{padding:14px 16px}
    .ipll-card-title{font-weight:600;font-size:14px;color:#222;margin-bottom:4px;line-height:1.4;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;transition:color .15s}
    .ipll-card:hover .ipll-card-title{color:#0073aa}
    .ipll-card-meta{font-size:12px;color:#777}
    .ipll-card-dl{ position:absolute; top:10px; right:10px; opacity:0; transition:opacity .15s; z-index:3; pointer-events:none; }
    .ipll-card:hover .ipll-card-dl,
.ipll-card:focus-within .ipll-card-dl{ opacity:1; pointer-events:auto; }
@media (hover:none){ .ipll-card-dl{ opacity:1; pointer-events:auto; } }
    .ipll-card-dl .ipll-btn.ipll-btn-ico{ padding:0; width:36px; height:36px; display:inline-flex; align-items:center; justify-content:center; border-radius:50%; box-shadow:0 2px 6px rgba(0,0,0,.15); }
    .ipll-card-dl .ipll-btn.ipll-btn-ico svg{ width:16px; height:16px; display:block; flex-shrink:0; }
    .ipll-empty{text-align:center;padding:40px 16px;color:#666;font-size:14px}
    .ipll-item.hide,.ipll-card.hide{display:none}

    /* RESPONSIVE */
    @media (max-width:800px){
        .ipll-toolbar{gap:10px}
        .ipll-search-box{flex:1 1 100%;order:1}
        .ipll-sort{flex:1 1 auto;max-width:none;order:2}
        .ipll-toggle{order:3}
        .ipll-grid{grid-template-columns:repeat(2,1fr);gap:14px}
    }
    @media (max-width:540px){
        .ipll-item{flex-direction:column;align-items:stretch;gap:12px}
        .ipll-btns{justify-content:stretch}
        .ipll-btn{flex:1;justify-content:center}
        .ipll-grid{grid-template-columns:1fr}
        .ipll-card-dl{opacity:1}
    }
    @media (prefers-reduced-motion:reduce){
        .ipll-item,.ipll-card,.ipll-btn,.ipll-spin,.ipll-search,.ipll-sort,.ipll-catsel,.ipll-chip,.ipll-tog-btn{transition:none;animation:none}
        .ipll-card:hover{transform:none}
    }

/* Word doc preview (no PDF.js) */
.ipll-preview-doc{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;background:#eef2fa;color:#2b579a;font-weight:700}
.ipll-preview-doc svg{stroke:#2b579a}
.ipll-preview-doc span{font-size:12px;letter-spacing:.05em}

/* ── Type tiles and image previews ──────────────────────────────────────── */

/*
 * An image previews as itself; everything a browser cannot render gets a
 * labelled tile instead. Colouring by family makes a mixed library scannable
 * without reading every filename — the shape is identical, only the accent
 * moves, so it reads as one set rather than a ransom note.
 */
.ipll-preview-img {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f3f4f6;
}
.ipll-preview-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ipll-preview-sheet   { color: #1a7f4b; }
.ipll-preview-slides  { color: #b8541b; }
.ipll-preview-archive { color: #5b5f73; }
.ipll-preview-text    { color: #4b5563; }

@media (prefers-color-scheme: dark) {
    .ipll-preview-img     { background: #1f2230; }
    .ipll-preview-sheet   { color: #5fd39b; }
    .ipll-preview-slides  { color: #f0a875; }
    .ipll-preview-archive { color: #a3a9c2; }
    .ipll-preview-text    { color: #c3c8dc; }
}


/* ── Categories: the filter, and the headings ───────────────────────────────
 *
 * The filter hides nodes that are already on the page — the same thing search
 * and sort have always done here. Nothing is fetched, so there is no second
 * place for the access rules to be decided and no layout jump while it waits.
 */
.ipll-cats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}
.ipll-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 8px 14px;
    border: 1px solid #d7dde6;
    border-radius: 999px;
    background-color: #fff;
    color: #31435a;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s;
}
.ipll-chip:hover { border-color: #0073aa; }
.ipll-chip:focus-visible { outline: 2px solid #0073aa; outline-offset: 2px; }
.ipll-chip[aria-pressed="true"] { background-color: #0073aa; border-color: #0073aa; color: #fff; }
.ipll-chip-n {
    font-weight: 500;
    font-size: 12px;
    padding: 1px 7px;
    border-radius: 999px;
    background-color: rgba(15, 28, 46, .07);
}
.ipll-chip[aria-pressed="true"] .ipll-chip-n { background-color: rgba(255, 255, 255, .22); }

/* The dropdown shares the toolbar's proportions with the sort select. */
.ipll-catsel { flex: 1 1 180px; min-width: 150px; max-width: 260px; }

.ipll-groups { display: flex; flex-direction: column; gap: 30px; }
.ipll-group-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.ipll-group-title { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; color: #222; }
.ipll-group-count { font-size: 13px; color: #777; white-space: nowrap; }
.ipll-group-rule { flex: 1 1 auto; height: 1px; background-color: #e5e5e5; }
.ipll-group.hide { display: none; }

/* A heading tag brings the browser's own margins with it; the look is the
 * class's job either way, so only what the UA adds is reset. */
.ipll h2.ipll-title, .ipll h3.ipll-title, .ipll h4.ipll-title, .ipll h5.ipll-title {
    margin: 0 0 3px;
    font-size: inherit;
    font-weight: inherit;
}
.ipll h2.ipll-card-title, .ipll h3.ipll-card-title,
.ipll h4.ipll-card-title, .ipll h5.ipll-card-title { margin-top: 0; }

/* Titles off, meta off: nothing left to pad. */
.ipll-card-info-bare { padding: 0; }

/* ── Fill-width page preview ────────────────────────────────────────────────
 *
 * Fit scales page 1 until all of it shows, which letterboxes it and draws the
 * type too small to read. Fill renders it to the card's width instead: the
 * letterhead meets both edges and the foot of the page sits below the fold.
 * That overhang is what the hover walks through.
 */
.ipll-preview-fill { align-items: flex-start; justify-content: flex-start; }
.ipll-preview-fill .ipll-canvas,
.ipll-preview-fill img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    max-width: none;
    max-height: none;
    object-fit: unset;
}

/*
 * --ipll-scroll is the measured overhang and --ipll-dur the time to cross it,
 * both written by portal.js once the page has actually rendered: a long page
 * and a short one then travel at the same rate instead of one whipping past.
 * Keyboard focus counts, so this is never mouse-only; hover:hover keeps it off
 * touch screens, where a tap should open the document rather than animate it.
 */
.ipll[data-scroll] .ipll-preview-fill .ipll-canvas,
.ipll[data-scroll] .ipll-preview-fill img {
    transition: transform var(--ipll-dur, 1.6s) cubic-bezier(.33, 0, .2, 1);
}
@media (hover: hover) {
    .ipll[data-scroll] .ipll-card:hover .ipll-preview-fill .ipll-canvas,
    .ipll[data-scroll] .ipll-card:focus-within .ipll-preview-fill .ipll-canvas,
    .ipll[data-scroll] .ipll-card:hover .ipll-preview-fill img,
    .ipll[data-scroll] .ipll-card:focus-within .ipll-preview-fill img {
        transform: translateY(calc(-1 * var(--ipll-scroll, 0px)));
    }
}

@media (prefers-reduced-motion: reduce) {
    .ipll-preview-fill .ipll-canvas,
    .ipll-preview-fill img { transition: none; }
    .ipll[data-scroll] .ipll-card:hover .ipll-preview-fill .ipll-canvas,
    .ipll[data-scroll] .ipll-card:focus-within .ipll-preview-fill .ipll-canvas,
    .ipll[data-scroll] .ipll-card:hover .ipll-preview-fill img,
    .ipll[data-scroll] .ipll-card:focus-within .ipll-preview-fill img { transform: none; }
}

@media (max-width: 800px) {
    /* A comfortable tap target once a finger is doing the pointing. */
    .ipll-chip { min-height: 44px; }
    .ipll-catsel { flex: 1 1 auto; max-width: none; order: 2; }
}

/* Shown only to staff, only when the access filter withheld something. */
.ipll-staff-note {
    margin: 14px 0 0;
    padding: 9px 12px;
    border-left: 3px solid #9a6b00;
    border-radius: 4px;
    background-color: #fdf6e6;
    color: #6b4a00;
    font-size: 13px;
    line-height: 1.5;
}
@media (prefers-color-scheme: dark) {
    .ipll-staff-note { background-color: #2b2416; color: #f0d9a8; }
}

/* ── Links ──────────────────────────────────────────────────────────────────
 *
 * A category can hold a web address as well as a file. A link row is the same
 * row a document gets — same grid, same spacing, same typography — because it
 * IS the same list; only the parts that genuinely differ look different: no
 * download button (there is no file), a destination where a size would be, and
 * a mark on anything that leaves the site.
 *
 * Everything here is additive. A page with no links renders not one byte of it.
 */

/* The tile a link card shows when it has no card image of its own. Same shape
 * as the type tiles above, so a mixed grid reads as one set. */
.ipll-preview.ipll-preview-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #e8f1ef;
    color: #0a5c55;
    font-weight: 700;
}
.ipll-preview.ipll-preview-link svg { stroke: currentColor; }
.ipll-preview.ipll-preview-link span {
    font-size: 11px;
    letter-spacing: .07em;
    text-transform: uppercase;
    /* A long domain must not push the tile wider than the card. */
    max-width: 88%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The corner badge. It sits where the download button sits on a document card,
 * and unlike that button it is always visible: it is a label, not an action,
 * so there is nothing to reveal on hover. */
.ipll-card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    pointer-events: none;
}
.ipll-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 9px;
    border-radius: 12px;
    background: #ffffff;
    color: #0a5c55;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}
.ipll-badge .ipll-ext { margin-left: -1px; }

/* The "leaves this site" arrow, in a list row's title and in the card badge. */
.ipll-ext {
    display: inline-flex;
    align-items: center;
    vertical-align: baseline;
    margin-left: .35em;
}
.ipll-ext svg {
    width: .72em;
    height: .72em;
    display: block;
    /* Optically centred against lowercase text rather than the line box. */
    transform: translateY(-.04em);
}
.ipll-badge .ipll-ext svg { width: 10px; height: 10px; transform: none; }

/* The list row's icon. The configured type icon is a document icon, so a link
 * draws its own; it inherits .ipll-pdf-icon's box and only changes the glyph. */
.ipll-link-icon { color: #0a5c55; }
.ipll-pdf-icon.ipll-link-icon svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
}

@media (prefers-color-scheme: dark) {
    .ipll-preview.ipll-preview-link { background: #16302c; color: #7fd8c9; }
    .ipll-badge        { background: #1f2230; color: #7fd8c9; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
    .ipll-link-icon    { color: #7fd8c9; }
}
