/**
 * Dorvan Read More – front-end styles
 *
 * Uses a CSS custom property (--drm-cutoff) set inline by JS
 * to define the precise collapse height for each container.
 */

/* ---- Collapsed state ---------------------------------------------------- */

.drm-collapsed {
    max-height: var(--drm-cutoff, 400px);
    overflow: hidden;

    /* Smooth expand transition */
    transition: max-height 0s;
}

.drm-expanded {
    /* Generous value to cover any article length */
    max-height: none;
    overflow: visible;
}

/* ---- Gradient overlay ---------------------------------------------------- */

.drm-overlay {
    position: relative;
    /*
     * Pull the overlay UP so it overlaps the bottom of the collapsed
     * container, creating the fade-out illusion. Height is set inline by JS
     * (--drm-overlay-h) so the fade spans the previewed lines of the next
     * paragraph; the 120px fallback keeps it working without JS sizing.
     */
    margin-top: calc(-1 * var(--drm-overlay-h, 120px));
    padding-top: var(--drm-overlay-h, 120px);
    /*
     * --drm-bg-rgb is set inline by JS from the admin-configured hex color
     * so the fade matches the site background. Falls back to white.
     */
    background: linear-gradient(to bottom,
            transparent 0%,
            rgba(var(--drm-bg-rgb, 255, 255, 255), 0.65) 35%,
            rgba(var(--drm-bg-rgb, 255, 255, 255), 0.95) 65%,
            rgb(var(--drm-bg-rgb, 255, 255, 255)) 100%);
    text-align: center;
    z-index: 10;

    /* Prevent text selection of the gradient area above the button */
    pointer-events: none;
}

/* ---- "Read more" button -------------------------------------------------- */

.drm-button {
    pointer-events: auto;
    /* override the overlay's none */
    display: inline-flex;
    align-items: center;

    /*
     * Everything that shapes the rectangle is in em, so the button grows and
     * shrinks with the admin-configured font size (--drm-button-font-size).
     * The em values reproduce the original 15px design (10px 28px padding).
     */
    gap: 0.4em;

    /* Long labels wrap instead of overflowing the viewport. */
    box-sizing: border-box;
    max-width: 100%;

    margin-top: 8px;
    margin-bottom: 24px;

    padding: 0.67em 1.87em;

    /* --drm-button-bg / --drm-button-fg are set inline by JS; fg auto-picks
       black or white for readable contrast against the chosen background. */
    background-color: var(--drm-button-bg, #e02020);
    color: var(--drm-button-fg, #ffffff);

    font-family: var(--drm-button-font-family, inherit);
    /* The vw cap shrinks large configured sizes on phones; since the whole
       rectangle is em-based, it scales down proportionally with the text. */
    font-size: min(var(--drm-button-font-size, 0.95rem), 7vw);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.03em;
    text-transform: uppercase;

    border: none;
    border-radius: 0.27em;
    cursor: pointer;

    transition: background-color 0.2s ease, transform 0.1s ease;
}

.drm-button::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 0.33em solid transparent;
    border-right: 0.33em solid transparent;
    border-top: 0.4em solid currentColor;
}

.drm-button:hover,
.drm-button:focus-visible {
    /* Darken the configured color for the hover/focus state */
    filter: brightness(0.88);
    outline: 2px solid var(--drm-button-bg, #e02020);
    outline-offset: 3px;
}

.drm-button:active {
    transform: scale(0.97);
}