/*
 * Cultina Read-More — a rich-text block that shows a collapsed excerpt and
 * expands/collapses via a toggle button. The collapsed height (--crm-collapsed)
 * is a responsive control, so the cut-off can be set per breakpoint (and set
 * high to effectively disable on a breakpoint — the button auto-hides when the
 * content already fits, class crm--fits added by JS).
 *
 * Progressive enhancement: WITHOUT JS the full text is shown and the toggle is
 * hidden (SEO/accessibility safe). The collapse + button only switch on once JS
 * adds .crm--js. Mechanics in assets/js/read-more.js.
 */

.crm {
    --crm-duration: 350ms;
    --crm-fade-height: 64px;
    --crm-toggle-gap: 16px;
}

.crm__content {
    position: relative;
}

/* No-JS / pre-init: full content, no clip. The clip turns on only with JS. */
.crm--js .crm__content {
    overflow: hidden;
    max-height: var(--crm-collapsed, 280px);
    transition: max-height var(--crm-duration, 350ms) var(--cultina-ease-out, cubic-bezier(0.16, 1, 0.3, 1));
}
/* Content already fits the collapsed height (set by JS) → show all, no clip. */
.crm--js.crm--fits .crm__content { max-height: none; }

/* Soft fade at the bottom of the collapsed excerpt (fades to the card colour). */
.crm--js .crm__content::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--crm-fade-height, 64px);
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--crm-fade-color, #E8F5F9));
    pointer-events: none;
    opacity: 1;
    transition: opacity var(--crm-duration, 350ms) ease;
}
.crm--js.is-open .crm__content::after,
.crm--js.crm--fits .crm__content::after { opacity: 0; }
.crm--no-fade .crm__content::after { display: none; }

/* Body copy (inherits the widget's typography/colour controls). */
.crm__body > :first-child { margin-top: 0; }
.crm__body > :last-child { margin-bottom: 0; }

/* Toggle button — hidden until JS, and when the content fits. */
.crm__actions {
    margin-top: var(--crm-toggle-gap, 16px);
}
.crm .crm__actions { display: none; }
.crm--js .crm__actions { display: block; }
.crm--js.crm--fits .crm__actions { display: none; }

/* Doubled .crm prefix: the Elementor Kit styles `.elementor-kit-5 button`
   (specificity 0,1,1) and would otherwise recolour/reset the toggle — out-specify
   it with .crm .crm__toggle (0,2,0). */
.crm .crm__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    font-family: var(--cultina-font-family, "Ubuntu", "Helvetica Neue", Arial, sans-serif);
    font-weight: var(--cultina-font-weight-bold, 700);
    font-size: 18px;
    line-height: 1.2;
    color: var(--crm-btn-color, var(--cultina-color-primary, #C2006A));
    text-decoration: underline;
    text-underline-offset: 3px;
}
.crm.crm--no-underline .crm__toggle { text-decoration: none; }
.crm .crm__toggle:hover,
.crm .crm__toggle:focus,
.crm .crm__toggle:focus-visible {
    color: var(--crm-btn-color-hover, var(--cultina-color-primary-hover, #A8005B));
    /* Neutralise the Elementor Kit's `button:hover/:focus` background bleed so
       the hover look is controlled solely by the widget's controls. A per-instance
       "Hintergrund (Hover)" control out-specifies this (element-id prefix). */
    background: none;
}
.crm .crm__toggle:focus-visible {
    outline: none;
    box-shadow: var(--cultina-focus-ring, 0 0 0 3px rgba(194, 0, 106, 0.35));
    border-radius: 4px;
}

/* Label swap between collapsed/expanded states. */
.crm__toggle-less { display: none; }
.crm.is-open .crm__toggle-more { display: none; }
.crm.is-open .crm__toggle-less { display: inline; }

/* Chevron affordance. */
.crm__chevron {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    fill: currentColor;
    transition: transform var(--crm-duration, 350ms) ease;
}
.crm.is-open .crm__chevron { transform: rotate(180deg); }

@media (prefers-reduced-motion: reduce) {
    .crm--js .crm__content,
    .crm--js .crm__content::after,
    .crm__chevron { transition: none; }
}
