/*
 * zhik_theme: light values, buttons, font, and the search-first header.
 * Spec: docs/superpowers/specs/2026-09-23-dam-theme-foundation-header-design.md
 * The header follows the approved mockup (light grey band, variant B) as closely as RS's markup allows.
 * Loaded after RS core CSS (include/plugin_functions.php get_plugin_css).
 * `:root:root` outranks RS's `html.mode-blue` value block.
 */

/* ---- Font: Outfit (SIL OFL, fonts/OFL.txt), self-hosted ---- */
@font-face {
    font-family: "Outfit";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/outfit-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Outfit";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/outfit-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Same selectors as RS's css/fonts/<font>.css, which loads earlier */
h1, h2, h3, h4, h5, h6, .Title,
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button, .ui-widget,
body, input, textarea, select, button {
    font-family: "Outfit", ui-sans-serif, system-ui, sans-serif;
}

/* ---- Values (light) ---- */
:root:root {
    --colour-brand-primary-default: #1f2937;
    --colour-brand-primary-hover: #111827;
    --colour-brand-primary-dark: #111827;
    --colour-brand-primary-darkest: #0b1220;
    --colour-brand-primary-light: #e9ecef;
    --colour-brand-primary-lightest: #f1f3f5;
    --colour-surface-header-background: #f1f3f5;
    --colour-surface-page-title-background: #f1f3f5;
    --colour-surface-view-background: #f7f8f9;

    --zt-button-bg: #dfe3e8;
    --zt-button-bg-hover: #d3d8de;
    --zt-button-bg-active: #c7cdd4;
    --zt-button-ink: #1f2937;
    --zt-header-line: #dfe3e8;
    --zt-ink: #0f172a;
    --zt-muted: #566173; /* mockup #64748b darkened to reach 4.5:1 on the grey band */
    --zt-icon-hover: #e6e9ed;
    --zt-soft: #e9ecef;
    --zt-soft-line: #bcc3cc;
    --zt-search-bg: #ffffff;
    --zt-badge: #d93025;
    --zt-radius: 10px;
    --zt-glass: rgba(255, 255, 255, 0.82); /* title chips and ⋮ on collection photos */
    --zt-glass-hover: rgba(255, 255, 255, 0.95);
    --zt-glass-ink: #0f172a;
    --zt-tile-empty: #e3e7eb;
    --zt-pill-on: #1f2937; /* a filter pill that has a value */
    --zt-pill-on-ink: #ffffff;
    --zt-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23566173' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --zt-chevron-on: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* ---- Primary action buttons: light grey with dark text ----
   Same selectors RS paints with the brand colour (css/light.css:413, css/global.css:4215,4672,4908,
   uppy in css/light.css:462). Small selected-state controls keep the brand fill with white text. */
button,
input[type=submit],
input[type=button],
.RecordPanel .RecordDownloadSpace .DownloadDBlend a,
.UploadButton a,
.button input[type=submit],
.button input[type=button],
.header-search-field #searchbutton,
#header-container a.UploadButton,
.uppy-DashboardContent-back,
.uppy-DashboardContent-back:focus,
.uppy-DashboardContent-addMore,
.uppy-DashboardContent-addMore:focus {
    background-color: var(--zt-button-bg);
    color: var(--zt-button-ink);
    box-shadow: none;
}

.button input[type=submit]:hover,
.button input[type=button]:hover,
.header-search-field #searchbutton:hover,
#header-container a.UploadButton:hover {
    background-color: var(--zt-button-bg-hover);
}

.button input[type=submit]:active,
.button input[type=button]:active,
.header-search-field #searchbutton:active,
#header-container a.UploadButton:active {
    background-color: var(--zt-button-bg-active);
}


/* ==== Header: row 1 logo + tabs + actions, row 2 search (phones: tabs get row 3) ==== */
header:not(.LoginHeader) {
    border-bottom: 1px solid var(--zt-header-line);
}

header:not(.LoginHeader) #header-container {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
        "logo   nav    actions"
        "search search search";
    align-items: center;
    column-gap: var(--space-24);
    row-gap: 0;
    padding: 0 20px;
    font-size: 13px;
}

/* ---- Row 1: logo (the Zhik logo is set in config.overrides.php) ---- */
header:not(.LoginHeader) #header-container .logo {
    grid-area: logo;
    justify-self: start;
    height: 60px;
    max-height: 60px;
    width: auto;
}

header:not(.LoginHeader) #header-container .logo img {
    max-height: 33px; /* 10% bigger than the mockup's 30px (Sean, 2026-09-24) */
}

/* ---- Row 1: menu links as tabs ---- */
header:not(.LoginHeader) #header-container > nav.primary-navigation {
    grid-area: nav;
    display: flex;
    align-items: center;
    align-self: stretch;
    /* Content width, not the whole 1fr column: at 1366px+ RS (js/header.js handlePrimaryNavigationOverflow)
       moves links into the ⋮ menu while the nav is wider than the space it computes, and a stretched nav
       made it move all of them. */
    justify-self: start;
    min-width: 0;
    margin-left: 0;
}

header:not(.LoginHeader) #header-container > nav.primary-navigation > ul {
    height: 100%;
    align-items: center;
    gap: 6px;
}

header:not(.LoginHeader) #header-container > nav.primary-navigation > ul > li:not(.menu-overflow) {
    font-size: 13px;
    line-height: 1;
}

/* Pill buttons (Sean's choice, 2026-09-24): outlined pill, current page filled dark with white text */
header:not(.LoginHeader) #header-container > nav.primary-navigation > ul > li:not(.menu-overflow) > a {
    display: flex;
    align-items: center;
    padding: 7px 14px;
    border: 1px solid var(--zt-header-line);
    border-radius: 999px;
    background: var(--zt-search-bg);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--zt-button-ink);
    text-decoration: none;
    white-space: nowrap;
}

header:not(.LoginHeader) #header-container > nav.primary-navigation > ul > li:not(.menu-overflow) > a:hover,
header:not(.LoginHeader) #header-container > nav.primary-navigation > ul > li:not(.menu-overflow) > a:focus-visible {
    background: var(--zt-soft);
    color: var(--zt-ink);
    text-decoration: none;
}

header:not(.LoginHeader) #header-container > nav.primary-navigation > ul > li:not(.menu-overflow) > a.zt-active,
header:not(.LoginHeader) #header-container > nav.primary-navigation > ul > li:not(.menu-overflow) > a.zt-active:hover {
    border-color: var(--colour-brand-primary-default);
    background: var(--colour-brand-primary-default);
    color: #fff;
}

/* "More" (links beyond 6): a round pill in the same style */
header:not(.LoginHeader) #header-container > nav.primary-navigation > button {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--zt-header-line);
    border-radius: 999px;
    background: var(--zt-search-bg);
    font-size: 17px;
    color: var(--zt-button-ink);
}

/* ---- Row 1: actions (Upload, Admin, Messages, Account) ---- */
header:not(.LoginHeader) #header-container .actions {
    grid-area: actions;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: var(--space-8);
    max-height: 60px;
}

header:not(.LoginHeader) #header-container a.UploadButton {
    order: -1; /* before Admin / Messages / Account, as in the mockup */
    width: auto;
    height: auto;
    gap: 6px;
    margin: 0 6px 0 0;
    padding: 8px 14px;
    border-radius: var(--zt-radius);
    font-size: 13px;
    font-weight: 600;
}

header:not(.LoginHeader) #header-container a.UploadButton > span {
    display: flex;
}

/* Upload icon: Lucide arrow-up-to-line, as in the mockup */
header:not(.LoginHeader) #header-container a.UploadButton i {
    font-size: 16px;
}

header:not(.LoginHeader) #header-container a.UploadButton i::before {
    content: "\e45b";
}

/* Admin / Messages / Account: bare 36px icons, no tile */
header:not(.LoginHeader) #header-container .actions .get-menu-content {
    width: 36px;
    height: 36px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: var(--zt-radius);
    background: transparent;
    color: var(--zt-muted);
    font-size: 19px;
}

header:not(.LoginHeader) #header-container .actions .get-menu-content:hover,
header:not(.LoginHeader) #header-container .actions .get-menu-content:focus-visible {
    background: var(--zt-icon-hover);
    color: var(--zt-ink);
}

header:not(.LoginHeader) #header-container .actions .get-menu-content .wrap-icon {
    position: relative;
    display: grid;
    place-items: center;
    font-size: 19px;
    color: inherit;
}

header:not(.LoginHeader) #header-container .actions .get-menu-content .wrap-icon > i {
    font-size: 19px;
}

header:not(.LoginHeader) #header-container .actions .get-menu-content .ProfileImage {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

/* Count badges: small red pills, top-right of the icon */
header:not(.LoginHeader) #header-container .actions .get-menu-content .wrap-icon > .Pill {
    position: absolute;
    top: -7px;
    right: -9px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--zt-badge);
    color: #fff;
    font-family: "Outfit", ui-sans-serif, system-ui, sans-serif;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
}

/* Phones: keep RS's collapse-on-scroll working (js/header.js adds .is-collapsed) */
header:not(.LoginHeader) #header-container .is-collapsed {
    max-height: 0;
}

/* The phone ☰ copy of the menu: every link it holds is in the visible tabs */
header:not(.LoginHeader) #header-container .actions > nav.primary-navigation {
    display: none;
}

/* ---- Row 2: search box = [magnifier] [input] [Filters] [Search] ---- */
header:not(.LoginHeader) #header-container .header-search-field {
    grid-area: search;
    width: 100%;
    margin-left: 0;
    padding: 4px 0 12px;
}

header:not(.LoginHeader) .header-search-field .input-wrapper {
    min-width: 0;
    height: 48px;
    max-height: 48px;
    gap: 10px;
    padding: 0 6px 0 14px;
    border: 1px solid var(--zt-header-line);
    border-radius: 12px;
    background: var(--zt-search-bg);
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
}

/* Decorative magnifier on the left (the real submit button is "Search" on the right) */
header:not(.LoginHeader) .header-search-field .input-wrapper::before {
    content: "\e151";
    font-family: "lucide";
    font-size: 18px;
    line-height: 1;
    color: var(--zt-muted);
}

header:not(.LoginHeader) .header-search-field .input-wrapper:focus-within {
    outline: 2px solid var(--form-focus);
    outline-offset: 2px;
}

header:not(.LoginHeader) .header-search-field .input-wrapper > input {
    height: 100%;
    background: transparent;
    font-size: 14px;
    color: var(--zt-ink);
}

header:not(.LoginHeader) .header-search-field .input-wrapper > input::placeholder {
    color: var(--zt-muted);
    opacity: 1;
}

/* Both buttons: text + icon pills; labels are added by hooks/all.php as <span class="zt-label"> */
header:not(.LoginHeader) .header-search-field .input-wrapper > button {
    display: flex;
    align-items: center;
    gap: 6px;
    width: auto;
    height: auto;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1;
    box-shadow: none;
}

header:not(.LoginHeader) .header-search-field .input-wrapper > button .zt-label {
    font-family: "Outfit", ui-sans-serif, system-ui, sans-serif;
    font-size: 13px;
    pointer-events: none; /* js/header.js matches clicks on the button itself */
}

/* Filters: outlined, Lucide list-filter icon, highlighted while open */
header:not(.LoginHeader) .header-search-field .input-wrapper > button[aria-controls="search-filters-panel"] {
    order: 2;
    border: 1px solid var(--zt-header-line);
    background: transparent;
    color: var(--zt-ink);
    font-weight: 500;
}

header:not(.LoginHeader) .header-search-field .input-wrapper > button[aria-controls="search-filters-panel"]:not(.icon-circle-x)::before {
    content: "\e460";
}

header:not(.LoginHeader) .header-search-field .input-wrapper > button[aria-controls="search-filters-panel"]:hover {
    background: var(--zt-icon-hover);
    color: var(--zt-ink);
    padding: 7px 10px;
}

header:not(.LoginHeader) .header-search-field .input-wrapper > button[aria-controls="search-filters-panel"][aria-expanded="true"] {
    background: var(--zt-soft);
    border-color: var(--zt-soft-line);
    color: var(--zt-ink);
}

/* AI search toggle (added by hooks/all.php when the clip plugin is active): outlined like Filters and just
   left of it; filled while AI mode is on. Filters is disabled in AI mode. */
header:not(.LoginHeader) .header-search-field .input-wrapper > button.zt-ai-toggle {
    order: 1;
    border: 1px solid var(--zt-header-line);
    background: transparent;
    color: var(--zt-ink);
    font-weight: 500;
}

header:not(.LoginHeader) .header-search-field .input-wrapper > button.zt-ai-toggle:hover {
    background: var(--zt-icon-hover);
    color: var(--zt-ink);
    padding: 7px 10px;
}

header:not(.LoginHeader) .header-search-field .input-wrapper > button.zt-ai-toggle[aria-pressed="true"],
header:not(.LoginHeader) .header-search-field .input-wrapper > button.zt-ai-toggle[aria-pressed="true"]:hover {
    border-color: var(--zt-pill-on);
    background: var(--zt-pill-on);
    color: var(--zt-pill-on-ink);
}

header:not(.LoginHeader) .header-search-field .input-wrapper > button[aria-controls="search-filters-panel"]:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Search: grey text button, no icon (desktop) */
header:not(.LoginHeader) .header-search-field .input-wrapper > button[type=submit] {
    order: 3;
    padding: 8px 14px;
    background: var(--zt-button-bg);
    color: var(--zt-button-ink);
    font-weight: 600;
}

header:not(.LoginHeader) .header-search-field .input-wrapper > button[type=submit]::before {
    display: none;
}

header:not(.LoginHeader) .header-search-field .input-wrapper > button[type=submit]:hover {
    background: var(--zt-button-bg-hover);
    color: var(--zt-button-ink);
    padding: 8px 14px;
}

/* Filters panel drops below the header band */
header:not(.LoginHeader) .header-search-field #search-filters-panel {
    border-radius: 0 0 var(--zt-radius) var(--zt-radius);
    box-shadow: 0 12px 32px rgb(15 23 42 / 0.12);
}

/* Content area height follows the real header height at 768px and up
   (RS hardcodes 144px / 80px; hooks/all.php keeps the variable current). */
@media (min-width: 768px) {
    :root:root {
        --uicenter-height: calc(100% - var(--js-header-container-bottom, 125px));
    }
}

/* ---- Phones: logo + actions / search / tabs ---- */
@media (max-width: 767.98px) {
    header:not(.LoginHeader) #header-container {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "logo   actions"
            "search search"
            "nav    nav";
        padding: 0 12px;
        column-gap: var(--space-8);
    }

    header:not(.LoginHeader) #header-container .logo {
        height: 54px;
    }

    header:not(.LoginHeader) #header-container .actions {
        gap: 2px;
    }

    /* Upload: icon only, accent colour */
    header:not(.LoginHeader) #header-container a.UploadButton {
        padding: 0;
        width: 36px;
        height: 36px;
        justify-content: center;
        background: transparent;
    }

    header:not(.LoginHeader) #header-container a.UploadButton > span {
        display: none;
    }

    header:not(.LoginHeader) .header-search-field .input-wrapper {
        height: 44px;
        max-height: 44px;
    }

    /* Icon-only buttons on phones; the Search button stays (as an icon) so submitting is still one tap */
    header:not(.LoginHeader) .header-search-field .input-wrapper > button .zt-label {
        display: none;
    }

    header:not(.LoginHeader) .header-search-field .input-wrapper > button[type=submit]::before {
        display: inline;
    }

    header:not(.LoginHeader) .header-search-field .input-wrapper > button[type=submit],
    header:not(.LoginHeader) .header-search-field .input-wrapper > button[type=submit]:hover {
        padding: 7px 9px;
        background: transparent;
    }

    header:not(.LoginHeader) #header-container > nav.primary-navigation {
        padding-bottom: 12px;
    }

    header:not(.LoginHeader) #header-container > nav.primary-navigation > ul {
        overflow-x: auto;
        scrollbar-width: none;
    }

    header:not(.LoginHeader) #header-container .logo img {
        max-width: 132px; /* 120px + 10% */
    }
}

/* RS sizes the Upload label itself; match the mockup's 13px */
header:not(.LoginHeader) #header-container a.UploadButton > span {
    font-size: 13px;
    font-weight: 600;
}

/* ==== List menus (Admin, System, My account) — enabled by $tilenav = false in config ==== */
.VerticalNav.TileReflow ul {
    list-style: none;
    max-width: 560px;
    margin: var(--space-8) 0 var(--space-16);
    padding: 4px;
    border: 1px solid var(--zt-header-line);
    border-radius: var(--zt-radius);
    background: var(--zt-search-bg);
}

.VerticalNav.TileReflow li {
    display: flex;
    align-items: center;
    float: none;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    text-align: left;
}

.VerticalNav.TileReflow li + li {
    border-top: 1px solid var(--zt-soft);
}

.VerticalNav.TileReflow li > a {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--zt-ink);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
}

.VerticalNav.TileReflow li > a:hover,
.VerticalNav.TileReflow li > a:focus-visible {
    background: var(--zt-soft);
    text-decoration: none;
}

.VerticalNav.TileReflow li > a i {
    min-width: 20px;
    padding: 0;
    font-size: 18px;
    color: var(--zt-muted);
}

/* resourcespace_mcp's menu item uses Font Awesome (fa-plug), which RS 11 doesn't load: map it to Lucide plug */
.VerticalNav a[href*="/plugins/resourcespace_mcp/"] i.fa-plug::before,
.TileNav a[href*="/plugins/resourcespace_mcp/"] i.fa-plug::before {
    content: "\e37f";
    font-family: "lucide";
    font-style: normal;
}

.VerticalNav.TileReflow .Pill {
    position: static;
    margin: 0 12px 0 auto;
    border-radius: 999px;
    background: var(--zt-badge);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

/* RS core bug (css/global.css:1800/1807): width:100% plus 16px side margins overflows by 32px on screens
   up to 1366px wide, which shows a horizontal scrollbar on Featured collections and home */
@media (max-width: 1366px) {
    #HomePanelContainer,
    .FeaturedSimpleLinks {
        width: auto;
    }
}

/* ==== Featured collections: bento grid, full-bleed photos, frosted title chips ====
   Markup: include/render_functions.php render_featured_collections() and render_new_featured_collection_cta().
   The first tile is a 2x2 hero, or the top-level smart collection (Products) when there is one: hooks/all.php
   marks it .zt-smart-root and gives it images. Call-to-action tiles (Create new collection, Upload) are wide bars. */
.FeaturedSimpleLinks {
    grid-template-columns: repeat(4, minmax(0, 1fr)); /* outranks RS's 3/2/1-column media rules */
    gap: 14px;
}

@media (max-width: 1024px) {
    .FeaturedSimpleLinks {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .FeaturedSimpleLinks {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
}

.FeaturedSimpleLinks > a.FeaturedSimpleTile {
    position: relative;
    isolation: isolate; /* the photo sits at z-index -1 behind the chip and ⋮, inside the tile */
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    background: var(--zt-tile-empty);
    box-shadow: none;
}

/* RS always draws smart collections after the others; Products leads instead */
.FeaturedSimpleLinks > a.FeaturedSimpleTile.zt-smart-root {
    order: -1;
}

/* The ⋮ flyout lives inside the tile, whose isolation keeps it below later tiles: lift the tile while
   its menu is open */
.FeaturedSimpleLinks > a.FeaturedSimpleTile:has(.top-right-menu.is-open) {
    z-index: 5;
}

.FeaturedSimpleLinks > a.FeaturedSimpleTile.zt-smart-root,
.FeaturedSimpleLinks:not(:has(> .zt-smart-root)) > a.FeaturedSimpleTile:first-of-type:not(:has(.tile-special-content)) {
    grid-column: span 2;
    grid-row: span 2;
}

.FeaturedSimpleLinks > a.FeaturedSimpleTile:hover {
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.16);
}

.FeaturedSimpleLinks > a.FeaturedSimpleTile:focus-visible {
    outline: 2px solid var(--zt-ink);
    outline-offset: 3px;
}

.FeaturedSimpleLinks .FeaturedSimpleTile .featured-tile {
    justify-content: flex-end;
    border-radius: inherit;
    background: transparent;
}

.FeaturedSimpleLinks .featured-tile-image-container {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    border-radius: inherit; /* the photo layer clips to the tile's corners itself */
}

.FeaturedSimpleLinks .featured-tile-image-container .thmbs-tile-img,
.FeaturedSimpleLinks .featured-tile-image-container .tile-multi,
.FeaturedSimpleLinks .featured-tile-image-container .tile-placeholder {
    height: 100%;
}

.FeaturedSimpleLinks .featured-tile-image-container .tile-placeholder {
    background: var(--zt-tile-empty);
}

.FeaturedSimpleLinks .featured-tile-image-container img {
    object-position: 50% 22%; /* people shots: keep heads in square crops */
}

@media (prefers-reduced-motion: no-preference) {
    .FeaturedSimpleLinks .featured-tile-image-container img {
        transition: transform 0.35s ease;
    }

    .FeaturedSimpleLinks > a.FeaturedSimpleTile:hover .featured-tile-image-container img {
        transform: scale(1.04);
    }
}

.FeaturedSimpleLinks .FeaturedSimpleTile .tile-desc {
    flex: none;
    align-items: flex-end;
    padding: 10px;
}

.FeaturedSimpleLinks .FeaturedSimpleTile .tile-desc h2 {
    max-width: 100%;
    overflow: hidden;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--zt-glass);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18); /* keeps the chip's edge on white product shots */
    color: var(--zt-glass-ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.FeaturedSimpleLinks > a.FeaturedSimpleTile.zt-smart-root .tile-desc,
.FeaturedSimpleLinks:not(:has(> .zt-smart-root)) > a.FeaturedSimpleTile:first-of-type:not(:has(.tile-special-content)) .tile-desc {
    padding: 16px;
}

.FeaturedSimpleLinks > a.FeaturedSimpleTile.zt-smart-root .tile-desc h2,
.FeaturedSimpleLinks:not(:has(> .zt-smart-root)) > a.FeaturedSimpleTile:first-of-type:not(:has(.tile-special-content)) .tile-desc h2 {
    padding: 8px 18px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* ⋮ menu: frosted circle, top right */
.FeaturedSimpleLinks .FeaturedSimpleTile .tile-desc > .top-right-menu {
    position: absolute;
    top: 10px;
    right: 10px;
    align-items: center;
    width: 30px;
    height: 30px;
    margin: 0;
    border-radius: 50%;
    background: var(--zt-glass);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
    color: var(--zt-glass-ink);
    font-size: 17px;
}

.FeaturedSimpleLinks .FeaturedSimpleTile .tile-desc > .top-right-menu:hover {
    background: var(--zt-glass-hover);
    color: var(--zt-glass-ink);
}

.FeaturedSimpleLinks .FeaturedSimpleTile .tile-desc > .top-right-menu i.icon-ellipsis-vertical {
    line-height: 1;
}

/* NEW! / resource count: small pill, top left */
.FeaturedSimpleLinks .FeaturedSimpleTile p.tile_corner_box {
    top: 10px;
    left: 10px;
    height: auto;
    margin: 0;
    padding: 5px 8px;
    border-radius: 999px;
    background: #ffffff;
    color: #0f172a;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Call-to-action tiles (Create new collection, Upload to this collection): small pill buttons, sized to
   their label, at the top left of their grid cell */
.FeaturedSimpleLinks > a.FeaturedSimpleTile:has(.tile-special-content) {
    grid-column: span 1;
    grid-row: auto;
    align-self: start;
    justify-self: start;
    width: auto;
    max-width: 100%;
    aspect-ratio: auto;
    min-height: 0;
    border-radius: 999px;
    background: var(--zt-tile-empty);
}

.FeaturedSimpleLinks > a.FeaturedSimpleTile:has(.tile-special-content):hover {
    background: var(--zt-button-bg-hover);
    box-shadow: none;
}

.FeaturedSimpleLinks .FeaturedSimpleTile:has(.tile-special-content) .featured-tile {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
}

.FeaturedSimpleLinks .FeaturedSimpleTile .tile-special-content {
    height: auto;
    padding: 5px 0 5px 5px;
    background: transparent;
}

.FeaturedSimpleLinks .FeaturedSimpleTile .tile-special-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.FeaturedSimpleLinks .FeaturedSimpleTile .tile-special-icon i {
    padding: 0;
    font-size: 15px;
}

.FeaturedSimpleLinks .FeaturedSimpleTile:has(.tile-special-content) .tile-desc {
    align-items: center;
    padding: 0 14px 0 8px;
}

.FeaturedSimpleLinks .FeaturedSimpleTile:has(.tile-special-content) .tile-desc h2 {
    padding: 0;
    border-radius: 0;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
    color: var(--zt-ink);
    font-size: 13.5px;
    white-space: nowrap;
}

/* ==== Filters panel: a row of pill drop-downs; search links, Clear and Search on a row below ====
   Markup: #search-filters-panel > #SearchBoxPanel > #search-panel-main (.field-input: label + select)
   and #simplesearchbuttons (.search-actions-primary: Search + Clear; .search-actions-secondary: links).
   Selectors carry #search-filters-panel to match RS's two-id rules in css/global.css. */
header:not(.LoginHeader) .header-search-field #search-filters-panel #SearchBoxPanel {
    display: flex;
    flex-direction: row; /* RS stacks the panel as a column (css/global.css, two-id selector) */
    max-width: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
}

header:not(.LoginHeader) .header-search-field #search-filters-panel #search-panel-main {
    display: contents;
}

header:not(.LoginHeader) .header-search-field #search-filters-panel #search-panel-main > .field-input {
    flex-direction: row;
    align-items: center;
    gap: 2px;
    min-height: 38px;
    padding: 0 3px 0 14px;
    border: 1px solid var(--zt-header-line);
    border-radius: 999px;
    background: var(--zt-search-bg);
    color: var(--zt-ink);
}

header:not(.LoginHeader) .header-search-field #search-filters-panel #search-panel-main > .field-input > label {
    margin: 0;
    color: inherit;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

header:not(.LoginHeader) .header-search-field #search-filters-panel #search-panel-main > .field-input > .clearerleft {
    display: none;
}

header:not(.LoginHeader) .header-search-field #search-filters-panel #search-panel-main > .field-input select {
    field-sizing: content; /* an empty "Any" option shrinks the pill to its label */
    width: auto;
    max-width: 220px;
    height: 32px;
    min-height: 0;
    padding: 0 26px 0 6px;
    border: 0;
    border-radius: 999px;
    background-color: transparent;
    background-image: var(--zt-chevron);
    background-position: center right 6px;
    background-size: 16px;
    color: var(--zt-muted);
    font-size: 13.5px;
    line-height: 32px;
    cursor: pointer;
}

/* A pill with a value turns dark (the blank / "All" option is the unset state) */
header:not(.LoginHeader) .header-search-field #search-filters-panel #search-panel-main > .field-input:has(select option:checked:not([value=""]):not([value="Global"])) {
    border-color: var(--zt-pill-on);
    background: var(--zt-pill-on);
    color: var(--zt-pill-on-ink);
}

header:not(.LoginHeader) .header-search-field #search-filters-panel #search-panel-main > .field-input:has(select option:checked:not([value=""]):not([value="Global"])) select {
    background-image: var(--zt-chevron-on);
    color: var(--zt-pill-on-ink);
}

/* Resource types is a select2 multi-select */
header:not(.LoginHeader) .header-search-field #search-filters-panel #search-panel-main > .field-input > .select2-container {
    width: auto !important; /* select2 writes an inline width */
    min-width: 150px;
}

header:not(.LoginHeader) .header-search-field #search-filters-panel #search-panel-main .select2-selection--multiple {
    min-height: 32px;
    padding: 0 4px;
    border: 0;
    background: transparent;
}

header:not(.LoginHeader) .header-search-field #search-filters-panel #search-panel-main .select2-selection--multiple .select2-selection__choice {
    margin: 4px 4px 0 0;
    border: 0;
    border-radius: 999px;
    background: var(--zt-soft);
    color: var(--zt-ink);
    font-size: 12.5px;
}

header:not(.LoginHeader) .header-search-field #search-filters-panel #simplesearchbuttons {
    display: flex;
    flex-basis: 100%;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 4px 0 0;
    padding: 10px 0 0;
    border-top: 1px solid var(--zt-soft);
}

header:not(.LoginHeader) .header-search-field #search-filters-panel #simplesearchbuttons .search-actions-secondary {
    display: flex;
    flex-wrap: wrap;
    order: 1;
    gap: 6px;
    margin: 0;
}

header:not(.LoginHeader) .header-search-field #search-filters-panel #simplesearchbuttons .search-actions-secondary a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--zt-soft);
    color: var(--zt-ink);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

header:not(.LoginHeader) .header-search-field #search-filters-panel #simplesearchbuttons .search-actions-secondary a span {
    text-decoration: none;
}

header:not(.LoginHeader) .header-search-field #search-filters-panel #simplesearchbuttons .search-actions-secondary a:hover,
header:not(.LoginHeader) .header-search-field #search-filters-panel #simplesearchbuttons .search-actions-secondary a:focus-visible {
    background: var(--zt-button-bg-hover);
}

header:not(.LoginHeader) .header-search-field #search-filters-panel #simplesearchbuttons .search-actions-primary {
    display: flex;
    flex-direction: row; /* RS reverses this group */
    align-items: center;
    order: 2;
    gap: 8px;
    margin: 0 0 0 auto;
}

header:not(.LoginHeader) .header-search-field #search-filters-panel #simplesearchbuttons .search-actions-primary > a {
    order: -1; /* Clear filters before Search */
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--zt-ink);
    font-size: 13.5px;
}

header:not(.LoginHeader) .header-search-field #search-filters-panel #simplesearchbuttons #searchbutton {
    height: 36px;
    min-height: 0;
    margin: 0;
    padding: 0 18px;
    line-height: 36px;
}

/* ==== Collection page header: grey breadcrumb trail, collection name as the title ==== */
#CentralSpace > .BreadcrumbsBox.BreadcrumbsBoxSlim.BreadcrumbsBoxTheme {
    display: block;
    margin: 18px 24px 4px;
    padding: 0;
    border-radius: 0;
    background: none;
}

#CentralSpace > .BreadcrumbsBoxTheme .SearchBreadcrumbs {
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 6px;
    color: var(--zt-muted);
    font-size: 13.5px;
}

#CentralSpace > .BreadcrumbsBoxTheme .SearchBreadcrumbs a,
#CentralSpace > .BreadcrumbsBoxTheme .SearchBreadcrumbs a:visited {
    color: var(--zt-muted);
    font-size: 13.5px;
    text-decoration: none;
}

#CentralSpace > .BreadcrumbsBoxTheme .SearchBreadcrumbs a:hover {
    color: var(--zt-ink);
    text-decoration: underline;
}

#CentralSpace > .BreadcrumbsBoxTheme .SearchBreadcrumbs > i {
    font-size: 14px;
}

#CentralSpace > .BreadcrumbsBoxTheme .SearchBreadcrumbs > i:has(+ a:last-of-type) {
    display: none; /* the chevron before the title would dangle at the end of the trail */
}

#CentralSpace > .BreadcrumbsBoxTheme .SearchBreadcrumbs > a:last-of-type {
    flex-basis: 100%;
    margin-top: 2px;
}

#CentralSpace > .BreadcrumbsBoxTheme .SearchBreadcrumbs > a:last-of-type,
#CentralSpace > .BreadcrumbsBoxTheme .SearchBreadcrumbs > a:last-of-type:visited,
#CentralSpace > .BreadcrumbsBoxTheme .SearchBreadcrumbs > a:last-of-type:hover {
    color: var(--zt-ink);
    font-size: 28px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    text-decoration: none;
}

/* Results toolbar: one aligned row */
.SearchSticky .TopInpageNavLeft {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.SearchSticky .TopInpageNavLeft > .InpageNavLeftBlock {
    margin: 0;
}

/* ==== Search results and collections (thumbnail view): justified rows ====
   hooks/all.php sets --zt-ar (image width / height) on each card from the thumbnail's width/height
   attributes. Growth in proportion to --zt-ar keeps every card in a row the same height, so images are
   never cropped; the ::after filler stops the last row stretching. Without JS, cards are squares. */
#CentralSpaceResources:has(> .resource-card.normal) {
    gap: 10px;
    padding: 16px 24px 24px;
}

#CentralSpaceResources:has(> .resource-card.normal)::after {
    content: "";
    flex-grow: 999;
}

#CentralSpaceResources > .resource-card.normal {
    --zt-row: 260px; /* hooks/all.php offers the 900px preview via srcset, so big cards stay sharp */
    position: relative;
    flex: var(--zt-ar, 1) 0 calc(var(--zt-ar, 1) * var(--zt-row));
    align-self: flex-start;
    width: auto;
    max-width: min(100%, calc(var(--zt-ar, 1) * var(--zt-row) * 1.6)); /* a card alone in a row stops growing */
    aspect-ratio: var(--zt-ar, 1);
    border-radius: 12px;
    background: none;
    box-shadow: none;
}

@media (max-width: 640px) {
    #CentralSpaceResources:has(> .resource-card.normal) {
        gap: 6px;
        padding: 12px;
    }

    #CentralSpaceResources > .resource-card.normal {
        --zt-row: 190px;
    }
}

#CentralSpaceResources > .resource-card.normal:hover {
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.16);
}

#CentralSpaceResources > .resource-card.normal.Selected {
    outline: 2px solid var(--zt-ink);
    outline-offset: 2px;
}

#CentralSpaceResources > .resource-card.normal > .resource-card-image {
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    overflow: hidden; /* the card itself stays unclipped so its ⋮ menu can overflow */
    border-radius: inherit;
    background: var(--zt-tile-empty);
}

#CentralSpaceResources > .resource-card.normal > .resource-card-image > .ImageColourWrapper {
    width: 100% !important; /* RS writes the thumbnail's pixel size inline */
    height: 100% !important;
    background-color: transparent !important; /* RS's dominant-colour placeholder; the tile grey shows instead */
}

#CentralSpaceResources > .resource-card.normal > .resource-card-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain; /* same shape as the card; very wide or tall images (clamped) get side bands, not cropped */
}

#CentralSpaceResources > .resource-card.normal > .resource-card-image .nopreview {
    font-size: 40px;
    opacity: 0.5;
}

@media (prefers-reduced-motion: no-preference) {
    #CentralSpaceResources > .resource-card.normal > .resource-card-image img {
        transition: transform 0.35s ease;
    }

    #CentralSpaceResources > .resource-card.normal:hover > .resource-card-image img {
        transform: scale(1.03);
    }
}

/* Controls float over the image; the gaps between them still click through to the preview */
#CentralSpaceResources > .resource-card.normal > .resource-card-action-bar {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    z-index: 2;
    padding: 8px;
    pointer-events: none;
}

#CentralSpaceResources > .resource-card.normal > .resource-card-action-bar > *,
#CentralSpaceResources > .resource-card.normal > .resource-card-content > * > *,
#CentralSpaceResources > .resource-card.normal .resource-card-content-bottom > * > * {
    pointer-events: auto;
}

#CentralSpaceResources > .resource-card.normal .resource-card-action-bar .check,
#CentralSpaceResources > .resource-card.normal .resource-card-action-menu,
#CentralSpaceResources > .resource-card.normal .resource-card-title,
#CentralSpaceResources > .resource-card.normal .resource-card-pill,
#CentralSpaceResources > .resource-card.normal .resource-card-type,
#CentralSpaceResources > .resource-card.normal .resource-card-add-remove {
    background: var(--zt-glass);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
    color: var(--zt-glass-ink);
}

#CentralSpaceResources > .resource-card.normal .resource-card-action-bar .check {
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 6px;
    font-size: 15px;
}

#CentralSpaceResources > .resource-card.normal .resource-card-action-bar input:checked + .check {
    background: var(--zt-pill-on);
    color: var(--zt-pill-on-ink);
}

#CentralSpaceResources > .resource-card.normal .resource-card-action-menu {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

#CentralSpaceResources > .resource-card.normal .resource-card-action-menu i {
    font-size: 17px;
}

#CentralSpaceResources > .resource-card.normal .resource-card-action-menu:hover {
    background: var(--zt-glass-hover);
}

#CentralSpaceResources > .resource-card.normal .resource-card-action-menu.is-open {
    background: var(--zt-pill-on);
    color: var(--zt-pill-on-ink);
}

/* Content: pills top left (after the checkbox), file type and add/remove bottom right, title below them
   across the full width (up to two lines) so the product name stays readable */
#CentralSpaceResources > .resource-card.normal > .resource-card-content {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto 1fr auto;
    gap: 6px;
    padding: 8px;
    pointer-events: none;
}

#CentralSpaceResources > .resource-card.normal .resource-card-content-bottom {
    display: contents;
}

#CentralSpaceResources > .resource-card.normal .resource-card-pill-bar {
    grid-area: 1 / 1 / 2 / 2;
    align-self: start;
    justify-self: start;
    min-width: 0;
    padding: 0 0 0 28px;
}

#CentralSpaceResources > .resource-card.normal .resource-card-pill {
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 12px;
}

#CentralSpaceResources > .resource-card.normal .resource-card-pill span {
    margin: 0;
}

/* "Active" is the normal state: a green tick; other states keep their label */
#CentralSpaceResources > .resource-card.normal .resource-card-status.active {
    width: 22px;
    padding: 0;
    justify-content: center;
    color: var(--colour-feedback-success-dark);
}

#CentralSpaceResources > .resource-card.normal .resource-card-status.active span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

#CentralSpaceResources > .resource-card.normal .resource-card-content-top {
    grid-area: 3 / 1 / 4 / 3;
    align-self: end;
    justify-self: start;
    max-width: 100%;
    min-width: 0;
    padding: 0;
}

#CentralSpaceResources > .resource-card.normal .resource-card-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    padding: 5px 11px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
}

#CentralSpaceResources > .resource-card.normal .resource-card-title a {
    color: var(--zt-glass-ink);
    white-space: normal;
}

#CentralSpaceResources > .resource-card.normal .resource-card-type-bar {
    grid-area: 2 / 1 / 3 / 3;
    align-self: end;
    justify-self: end;
    gap: 6px;
}

#CentralSpaceResources > .resource-card.normal .resource-card-type {
    flex: none;
    align-items: center;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

#CentralSpaceResources > .resource-card.normal .resource-card-type i {
    width: 13px;
    height: 13px;
    font-size: 13px;
}

#CentralSpaceResources > .resource-card.normal .resource-card-add-remove {
    width: 26px;
    height: 26px;
    border-radius: 50%;
}

#CentralSpaceResources > .resource-card.normal .resource-card-add-remove.removeFromCollection:not(.DisplayNone) {
    background: var(--zt-pill-on);
    color: var(--zt-pill-on-ink);
}

#CentralSpaceResources > .resource-card.normal .resource-card-add-remove.removeFromCollection:not(.DisplayNone):hover {
    background: var(--colour-feedback-error-dark);
}

/* ==== Resource view (page and modal): the image first, big, with previous / next on it ====
   Image on the left, file information and tools on the right; everything else runs full width below.
   hooks/all.php adds the ‹ › buttons and swipe (they click RS's own prevLink / nextLink) and swaps the
   preview for the sharper "scr" size. */
.RecordResource:has(> #previewimagewrapper) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    gap: 20px 24px;
    align-items: start;
}

.RecordResource:has(> #previewimagewrapper) > * {
    grid-column: 1 / -1;
    float: none;
    min-width: 0;
}

.RecordResource:has(> #previewimagewrapper) > .clearerleft {
    display: none;
}

.RecordResource > #previewimagewrapper {
    grid-area: 1 / 1 / 2 / 2;
    position: relative;
    width: auto;
    margin: 0;
}

.RecordResource:has(> #previewimagewrapper) > #RecordDownloadTabContainer {
    grid-area: 1 / 2 / 2 / 3;
    width: auto;
    margin: 0;
}

/* The image is as big as the column and --zt-stage-h allow. hooks/all.php sets --zt-ar (width / height)
   once the preview loads, so the stage takes the image's shape and doesn't jump when "scr" replaces it. */
#previewimagewrapper {
    --zt-stage-h: calc(min(75vh, 860px) - 32px);
}

#previewimagewrapper > #previewimagelink {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    padding: 16px;
    box-sizing: border-box;
    border-radius: 16px;
    background: var(--zt-tile-empty);
}

#previewimagewrapper > #previewimagelink > #previewimage {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: var(--zt-stage-h);
    margin: 0;
    border-radius: 6px;
}

#previewimagewrapper > #previewimagelink > #previewimage[style*="--zt-ar"] {
    width: min(100%, calc(var(--zt-stage-h) * var(--zt-ar)));
    max-height: none;
    aspect-ratio: var(--zt-ar);
}

/* The dark bar under the image: its tool buttons float on the image, bottom right */
#previewimagewrapper > #PreviewTools {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 2;
    width: auto;
    background: none;
}

#previewimagewrapper > #PreviewTools #PreviewToolsOptionsWrapper {
    display: flex;
    gap: 8px;
    width: auto;
    background: none;
}

#previewimagewrapper > #PreviewTools .ToolsOptionLink {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    background: var(--zt-glass);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
    color: var(--zt-glass-ink);
}

#previewimagewrapper > #PreviewTools .ToolsOptionLink:hover {
    background: var(--zt-glass-hover);
}

/* Previous / next on the image */
#previewimagewrapper > .zt-step {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--zt-glass);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
    color: var(--zt-glass-ink);
    font-size: 22px;
    cursor: pointer;
    transform: translateY(-50%);
}

#previewimagewrapper > .zt-step:hover {
    background: var(--zt-glass-hover);
}

#previewimagewrapper > .zt-step:focus-visible {
    outline: 2px solid var(--zt-ink);
    outline-offset: 2px;
}

#previewimagewrapper > .zt-step-prev {
    left: 12px;
}

#previewimagewrapper > .zt-step-next {
    right: 12px;
}

/* File information and tools: one quiet panel */
.RecordResource:has(> #previewimagewrapper) > #RecordDownloadTabContainer .RecordDownloadSpace {
    width: auto;
    box-sizing: border-box;
    border-radius: 0 12px 12px 12px;
}

.RecordResource:has(> #previewimagewrapper) > #RecordDownloadTabContainer .RecordTools {
    width: auto;
}

@media (max-width: 900px) {
    .RecordResource:has(> #previewimagewrapper) {
        grid-template-columns: minmax(0, 1fr);
    }

    .RecordResource:has(> #previewimagewrapper) > #RecordDownloadTabContainer {
        grid-area: 2 / 1 / 3 / 2;
    }

    #previewimagewrapper {
        --zt-stage-h: calc(min(65vh, 640px) - 16px);
    }

    #previewimagewrapper > #previewimagelink {
        min-height: 240px;
        padding: 8px;
    }
}

@media (max-width: 640px) {
    #previewimagewrapper > .zt-step {
        width: 38px;
        height: 38px;
        font-size: 20px;
    }

    #previewimagewrapper > .zt-step-prev {
        left: 8px;
    }

    #previewimagewrapper > .zt-step-next {
        right: 8px;
    }
}

/* ==== Home dashboard: picture tiles (featured collection, promoted resource) match Featured collections ====
   Markup: include/dash_tile_generation.php. Text, chart and other tile types are left as RS draws them. */
#HomePanelContainer > a.DashTile:has(> .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder)) {
    position: relative;
    isolation: isolate;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    background: var(--zt-tile-empty);
    box-shadow: none;
}

#HomePanelContainer > a.DashTile:has(> .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder)).DoubleWidthDashTile {
    aspect-ratio: 2 / 1;
}

#HomePanelContainer > a.DashTile:has(> .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder)):hover {
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.16);
}

#HomePanelContainer > a.DashTile:has(> .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder)) > .HomePanelDynamicDash {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    width: 100%;
    border-radius: inherit;
    background: transparent;
}

#HomePanelContainer > a.DashTile:has(> .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder)) > .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder) {
    position: absolute;
    inset: 0;
    z-index: -1;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    overflow: hidden;
}

#HomePanelContainer > a.DashTile:has(> .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder)) > .HomePanelDynamicDash > img.thmbs-tile-img {
    object-fit: cover;
    object-position: 50% 22%;
}

/* Three-image tiles (Products and its categories, filled by hooks/all.php): the large image fills its column */
#HomePanelContainer > a.DashTile:has(> .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder)) > .HomePanelDynamicDash > .tile-multi > img.thmbs-tile-img {
    height: 100%;
    object-fit: cover;
    object-position: 50% 22%;
}

#HomePanelContainer > a.DashTile:has(> .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder)) > .HomePanelDynamicDash > .tile-placeholder {
    background: var(--zt-tile-empty);
}

@media (prefers-reduced-motion: no-preference) {
    #HomePanelContainer > a.DashTile:has(> .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder)) > .HomePanelDynamicDash img {
        transition: transform 0.35s ease;
    }

    #HomePanelContainer > a.DashTile:has(> .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder)):hover > .HomePanelDynamicDash img {
        transform: scale(1.04);
    }
}

#HomePanelContainer > a.DashTile:has(> .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder)) .tile-desc {
    flex: none;
    align-items: flex-start;
    gap: 4px;
    padding: 10px;
}

#HomePanelContainer > a.DashTile:has(> .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder)) .tile-desc :is(h2, p) {
    max-width: 100%;
    overflow: hidden;
    margin: 0;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--zt-glass);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
    color: var(--zt-glass-ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0;
    white-space: nowrap;
    text-overflow: ellipsis;
}

#HomePanelContainer > a.DashTile:has(> .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder)) .tile-desc p {
    padding: 4px 10px;
    font-size: 12.5px;
    font-weight: 500;
}

/* Edit / delete: frosted circles, top right */
#HomePanelContainer > a.DashTile:has(> .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder)) .DashTileActions {
    position: absolute;
    inset: 10px 10px auto auto; /* RS pins this bar full width from the left */
    display: flex;
    gap: 6px;
    width: auto;
    margin: 0;
    padding: 0;
    background: none;
}

#HomePanelContainer > a.DashTile:has(> .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder)) .DashTileActions .tool {
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    background: none;
}

#HomePanelContainer > a.DashTile:has(> .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder)) .DashTileActions .tool a {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    background: var(--zt-glass);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
    color: var(--zt-glass-ink);
    font-size: 15px;
}

#HomePanelContainer > a.DashTile:has(> .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder)) .DashTileActions .tool a:hover {
    background: var(--zt-glass-hover);
}

#HomePanelContainer > a.DashTile:has(> .HomePanelDynamicDash > :is(.thmbs-tile-img, .tile-multi, .tile-placeholder)) p.tile_corner_box {
    top: 10px;
    left: 10px;
    height: auto;
    margin: 0;
    padding: 5px 8px;
    border-radius: 999px;
    background: #ffffff;
    color: #0f172a;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ==== Login page: solid orange ground, frosted card in the middle ====
   Markup: login.php (#CentralSpaceLogin: #LoginHeader, simplesaml's p.external-login-link, #loginform);
   hooks/login.php adds the title and the "Sign in with email" switch (.zt-login-sso / .zt-login-email).
   The orange is the login page's own colour, chosen by Sean (2026-09-25); the app itself stays grey. */
html:has(#UICenter.LoginPage),
body:has(#UICenter.LoginPage),
#UICenter.NoSearch.LoginPage {
    background: #ed6d3c;
}

#UICenter.NoSearch.LoginPage,
#UICenter.NoSearch.LoginPage.slideshow-enabled {
    display: grid;
    place-items: center;
    box-sizing: border-box;
    min-height: 100%;
    padding: 48px 16px 80px;
}

#UICenter.LoginPage > #login-slideshow {
    display: none;
}

#UICenter.LoginPage > #CentralSpaceLogin {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 22px;
    box-sizing: border-box;
    width: min(420px, 100%);
    margin: 0;
    padding: 36px 32px 28px;
    overflow: visible;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.8);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    box-shadow: 0 30px 70px rgba(80, 25, 5, 0.35);
    color: #0f172a;
}

@media (max-width: 520px) {
    #UICenter.LoginPage > #CentralSpaceLogin {
        padding: 28px 22px 22px;
    }
}

/* Order: logo, title, errors, Microsoft, "Sign in with email", form */
#UICenter.LoginPage > #CentralSpaceLogin > * {
    order: 3;
}

#UICenter.LoginPage > #CentralSpaceLogin > #LoginHeader {
    order: 1;
    margin: 0 auto;
    padding: 0;
    background: none;
}

#UICenter.LoginPage > #CentralSpaceLogin > .zt-login-intro {
    order: 2;
}

#UICenter.LoginPage > #CentralSpaceLogin > .external-login-link {
    order: 4;
}

#UICenter.LoginPage > #CentralSpaceLogin > .zt-login-switch {
    order: 5;
}

#UICenter.LoginPage > #CentralSpaceLogin > #loginform {
    order: 6;
}

#UICenter.LoginPage #LoginHeader img {
    display: block;
    width: auto;
    max-width: 100%;
    height: 64px;
    max-height: none;
}

#UICenter.LoginPage .zt-login-intro h1 {
    margin: 0;
    padding: 0;
    color: #0f172a;
    font-size: 21px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

#UICenter.LoginPage .zt-login-intro p {
    margin: 3px 0 0;
    padding: 0;
    color: #566173;
    font-size: 13.5px;
}

/* Sign in with Microsoft: full width, Microsoft's light button style (white, #8c8c8c edge, #5e5e5e text) */
#UICenter.LoginPage .external-login-link {
    margin: 0;
    padding: 0;
}

#UICenter.LoginPage .external-login-link br,
#UICenter.LoginPage .external-login-link i {
    display: none;
}

#UICenter.LoginPage .external-login-link a:is(:link, :visited, :hover, :active) {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 46px;
    padding: 0 18px;
    border: 1px solid #8c8c8c;
    border-radius: 10px;
    background: #ffffff;
    color: #5e5e5e;
    font: 600 15px/1 "Segoe UI", "Outfit", ui-sans-serif, system-ui, sans-serif;
    text-decoration: none;
}

#UICenter.LoginPage .external-login-link a:hover {
    background: #f3f4f6;
}

#UICenter.LoginPage .external-login-link a::before {
    content: "";
    flex: none;
    width: 20px;
    height: 20px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 21 21'%3E%3Crect x='1' y='1' width='9' height='9' fill='%23f25022'/%3E%3Crect x='11' y='1' width='9' height='9' fill='%237fba00'/%3E%3Crect x='1' y='11' width='9' height='9' fill='%2300a4ef'/%3E%3Crect x='11' y='11' width='9' height='9' fill='%23ffb900'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* "Sign in with email" and "← Sign in with Microsoft": small text buttons */
#UICenter.LoginPage #CentralSpaceLogin .zt-login-switch {
    align-self: center;
    min-height: 0;
    margin: -10px 0 0;
    padding: 4px 0;
    border: 0;
    background: none;
    box-shadow: none;
    color: #0f172a;
    font: 500 14px/1.2 "Outfit", ui-sans-serif, system-ui, sans-serif;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

#UICenter.LoginPage #CentralSpaceLogin .zt-login-switch.zt-login-back {
    align-self: flex-start;
    margin: 4px 0 0;
}

#CentralSpaceLogin.zt-login-sso:not(.zt-login-email) #login_box,
#CentralSpaceLogin.zt-login-email > .external-login-link,
#CentralSpaceLogin.zt-login-email > .zt-login-switch {
    display: none;
}

/* With the email box hidden, the form only holds hidden fields and the absolutely placed footer */
#UICenter.LoginPage > #CentralSpaceLogin.zt-login-sso:not(.zt-login-email) > #loginform {
    margin-top: -22px;
}

/* Email form inside the card */
#UICenter.LoginPage #loginform {
    gap: 0; /* its second child only holds hidden fields and the footer */
}

#UICenter.LoginPage #login_box {
    padding: 0;
    border-radius: 0;
    background: transparent;
}

#UICenter.LoginPage #login_box .field-input input:is([type="text"], [type="password"]) {
    height: 44px;
    border: 1px solid #dfe3e8;
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
}

#UICenter.LoginPage #login_box .button input[type="submit"] {
    width: 100%;
    height: 44px;
    border: 0;
    border-radius: 10px;
    background: #1f2937;
    color: #ffffff;
    font-weight: 600;
}

#UICenter.LoginPage #login_box .button input[type="submit"]:hover {
    background: #111827;
}

/* Not shown on the login page: account requests, time zone and language (defaults still submit) */
#UICenter.LoginPage .login-link:has(#account_apply),
#UICenter.LoginPage #loginform .field-input:has(#user_local_tz),
#UICenter.LoginPage #loginform .field-input:has(#language) {
    display: none;
}

/* "Powered by ResourceSpace", just below the card */
#UICenter.LoginPage #login-footer {
    position: absolute;
    top: calc(100% + 18px);
    right: 0;
    left: 0;
    float: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    text-align: center;
}

#UICenter.LoginPage #login-footer p {
    margin: 0;
}

#UICenter.LoginPage #login-footer a:is(:link, :visited, :hover) {
    color: inherit;
}
