/*
 * Padding on the sidebar itself handles all edge spacing uniformly:
 * - top gap before the first block
 * - side gaps (prevents overlap with sidebar's ::before left border)
 * - bottom gap after the last block
 * This means blocks no longer need horizontal margins for edge clearance.
 */
.pkp_structure_sidebar {
    padding: 0.75rem !important;
}

/*
 * Override Manuscript theme's block padding (2.143rem) so the title
 * can sit flush against the card border. Only bottom margin needed
 * between blocks — the sidebar padding handles all edge spacing.
 */
.pkp_structure_sidebar > .pkp_block {
    padding: 0 !important;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    margin: 0 0 1rem 0;
    transition: border-color 0.2s ease;
}

/* No extra gap needed after the last block — sidebar padding covers it */
.pkp_structure_sidebar > .pkp_block:last-child {
    margin-bottom: 0;
}

.pkp_structure_sidebar > .pkp_block:hover {
    border-color: #F7BC4A;
}

/*
 * Accordion-style title header:
 * - display: block !important overrides Manuscript's inline-block
 * - border-bottom: none !important removes the gold underline (#f7bc4a)
 * - margin: 0 !important removes the margin-bottom: 0.714rem
 * - overflow: hidden on parent + no margin = flush to all 3 card edges
 */
.pkp_structure_sidebar > .pkp_block > .title {
    display: block !important;
    background-color: #ccc;
    color: #333 !important;
    padding: 0.6rem 1rem !important;
    margin: 0 !important;
    font-size: 0.9rem !important;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: none !important;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.pkp_structure_sidebar > .pkp_block:hover > .title {
    background-color: #F7BC4A;
    color: #222 !important;
}

/* Restore comfortable padding to the content area */
.pkp_structure_sidebar > .pkp_block > .content {
    padding: 0.75rem 1rem;
}

/* ── Tools block: each li is a bordered card, image is 200×50px ────────────
 * padding: 1.5rem gives the card visible breathing room around the 50px
 * image, making the card itself ~83px tall — noticeably "bigger" than
 * the logo inside it, matching the reference look.
 * object-fit: contain prevents distortion if the source image doesn't
 * match the 4:1 ratio exactly — it letterboxes rather than squishes.
 * ───────────────────────────────────────────────────────────────────────── */
#customblock-tools .content ul li {
    border: 1px solid #ccc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem !important; /* override Manuscript's 0.357rem 0 */
    margin-bottom: 0.75rem;
    transition: border-color 0.2s ease;
}

#customblock-tools .content ul li:last-child {
    margin-bottom: 0;
}

#customblock-tools .content ul li:hover {
    border-color: #FFE203;
}

/* Anchor fills the card so the whole box is clickable */
#customblock-tools .content ul li > a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* Force image to exactly 200×50px; object-fit: contain keeps it clean */
#customblock-tools .content ul li img {
    width: 200px;
    height: 50px;
    object-fit: contain;
    display: block;
}
