/* ===========================================================================
 * Base layout — applies to every consumer (shortcode AND Elementor widgets).
 * Only structural rules: flexbox direction, no-list-bullets, anchor-jump
 * offset. Visual properties (colors, padding, backgrounds, radii, type)
 * live under the .khson-downloads--default modifier so widget rendering
 * stays neutral and can be fully driven by Elementor Style controls or a
 * Loop-Item template.
 * ========================================================================= */

.khson-downloads { display: flex; flex-direction: column; }

/* Grid layout — number of columns and gap are widget-controlled per
   breakpoint. Default below covers the shortcode path; widget renders
   override via {{WRAPPER}} selectors. */
.khson-downloads-nav { display: grid; }

.khson-downloads-section {
    display: flex;
    flex-direction: column;
    /* Anchor-jump offset honored by scrollIntoView() in downloads-anchor.js.
       150px clears OceanWP's full top bar + sticky main nav with room to
       breathe so the heading reads as the start of a new section. */
    scroll-margin-top: 150px;
}

.khson-downloads-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* No layout on the base item — when the consumer renders a Loop-Item
   template, the item just holds one full-width child. A flex container
   with justify-content: space-between collapses single children to their
   content width, so this is intentionally inert. */
.khson-downloads-item { }

/* Row variant — title-left, button-right layout used by the shortcode
   and by the widget's fallback render path. */
.khson-downloads-item--row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.khson-downloads-item-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.khson-downloads-pill {
    /* Pills fill their grid cell — width:100% is implicit since flex
       block-level grid items take their cell, but explicit is friendlier
       to debuggers. justify/align-content keeps text+icon centered. */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.khson-downloads-heading,
.khson-downloads-subheading { margin: 0; }

/* Breathing room between a Kategorie subheading and the previous bucket's
 * file list. Adjacent-sibling so it only fires inside the nested internal
 * render — first subheading directly after the Innung headline (no prior
 * list) gets no extra top margin. */
.khson-downloads-list + .khson-downloads-subheading { margin-top: 16px; }

.khson-downloads-btn { flex-shrink: 0; }


/* ===========================================================================
 * Visual defaults — only when the consumer opts in via the --default
 * modifier. The [khson_downloads] shortcode template adds this; Elementor
 * widgets do not, so widget styles flow from their own controls.
 * ========================================================================= */

.khson-downloads--default { gap: 32px; }
.khson-downloads--default .khson-downloads-nav {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}
.khson-downloads--default .khson-downloads-section { gap: 12px; }
.khson-downloads--default .khson-downloads-list { gap: 8px; }

.khson-downloads--default .khson-downloads-pill {
    padding: 12px 20px;
    background: var(--khson-primary, #0073aa);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.khson-downloads--default .khson-downloads-pill:hover,
.khson-downloads--default .khson-downloads-pill:focus {
    background: var(--khson-primary-hover, #005a87);
    color: #fff;
}

.khson-downloads--default .khson-downloads-heading {
    font-size: 24px;
    font-weight: 700;
    color: var(--khson-primary, #0073aa);
}

.khson-downloads--default .khson-downloads-item {
    padding: 12px 16px;
    background: #f5f5f5;
    border-radius: 4px;
}

.khson-downloads--default .khson-downloads-link {
    color: #222;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
}

.khson-downloads--default .khson-downloads-link:hover { text-decoration: underline; }

.khson-downloads--default .khson-downloads-meta {
    color: #666;
    font-size: 14px;
}

@media (max-width: 600px) {
    .khson-downloads--default .khson-downloads-item--row {
        flex-direction: column;
        align-items: stretch;
    }
    .khson-downloads--default .khson-downloads-btn {
        text-align: center;
    }
}
