/**
 * Downloader widget — shared by every platform.
 *
 * One stylesheet for all downloaders. The brand colour arrives per instance as
 * --dl-accent / --dl-on-accent (set inline by the shortcode), so the markup and
 * rules stay identical while each platform keeps its own look.
 *
 * Loaded only when a downloader shortcode is on the page.
 */

.dl {
    --dl-accent: var(--primary-color, #E91E63);
    --dl-on-accent: #ffffff;
    max-width: 720px;
    margin: 2rem auto;
    padding: 2rem 1.5rem;
    background: var(--bg-white, #fff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 16px;
    box-shadow: var(--shadow-md, 0 4px 6px rgba(0, 0, 0, .1));
    text-align: center;
}

.dl--left {
    margin-left: 0;
    text-align: left;
}

.dl__title {
    margin: 0 0 .5rem;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-dark, #212529);
}

.dl__subtitle {
    margin: 0 0 1.5rem;
    color: var(--text-light, #6c757d);
    font-size: 1rem;
}

.dl__form { margin: 0; }

.dl__input-wrap {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: var(--bg-light, #f8f9fa);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 50px;
    padding: .35rem .35rem .35rem 1rem;
    transition: var(--transition, all .3s ease);
}

.dl__input-wrap:focus-within {
    border-color: var(--dl-accent);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, .08);
}

.dl__input-icon {
    color: var(--dl-accent);
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 1.35em;
    text-align: center;
}

.dl__input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    padding: .75rem .5rem;
    font-size: 1rem;
    color: var(--text-dark, #212529);
    outline: none;
}

.dl__btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
    border: 0;
    border-radius: 50px;
    padding: .75rem 1.5rem;
    background: var(--dl-accent);
    color: var(--dl-on-accent);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition, all .3s ease);
}

.dl__btn:hover:not(:disabled) { filter: brightness(1.1); }
.dl__btn:disabled { opacity: .65; cursor: not-allowed; }

.dl__note {
    margin: 1rem 0 0;
    font-size: .875rem;
    color: var(--text-light, #6c757d);
}

.dl__result { margin-top: 1.5rem; }

.dl__loading,
.dl__error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: 1rem;
    border-radius: 12px;
    font-size: .95rem;
}

.dl__loading {
    background: var(--bg-light, #f8f9fa);
    color: var(--text-light, #6c757d);
}

.dl__error {
    background: #fdecea;
    color: #b3261e;
    text-align: left;
}

/* Download-time notice, shown above the result card it refers to. */
.dl__error[data-social-notice] { margin-bottom: 1rem; }

.dl__card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 0 1rem;
    padding: 1rem;
    background: var(--bg-light, #f8f9fa);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 12px;
    text-align: left;
}

.dl__cover {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    background: #e9ecef;
}

.dl__card-meta { min-width: 0; }

/* Cover on the left, spanning the details and the buttons beside it. */
.dl__card--has-cover { grid-template-columns: 110px minmax(0, 1fr); }
.dl__card--has-cover .dl__cover { grid-row: span 2; }
.dl__card--has-cover .dl__card-meta,
.dl__card--has-cover .dl__actions { grid-column: 2; }

.dl__actions { min-width: 0; }

/* Filename is for the hero (glass) rows only. */
.dl__download-file { display: none; }

.dl__item-title {
    margin: 0 0 .35rem;
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--text-dark, #212529);
    word-break: break-word;
}

.dl__meta-row {
    margin: 0 0 .2rem;
    font-size: .875rem;
    color: var(--text-light, #6c757d);
    display: flex;
    align-items: center;
    gap: .4rem;
}

.dl__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .75rem;
}

.dl__download {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    border: 0;
    border-radius: 50px;
    padding: .6rem 1.15rem;
    background: var(--dl-accent);
    color: var(--dl-on-accent);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition, all .3s ease);
}

/* Alternate formats stay readable without competing with the primary action. */
.dl__download--secondary,
.dl__download--image {
    background: var(--text-light, #6c757d);
    color: #fff;
}

.dl__download--audio {
    background: transparent;
    color: var(--text-dark, #212529);
    box-shadow: inset 0 0 0 2px var(--dl-accent);
}

.dl__download:hover:not(:disabled) { filter: brightness(1.1); }
.dl__download:disabled { opacity: .65; cursor: not-allowed; }

@media (max-width: 575px) {
    .dl { padding: 1.5rem 1rem; }

    .dl__input-wrap {
        flex-wrap: wrap;
        border-radius: 16px;
        padding: .75rem;
    }

    .dl__input { width: 100%; flex-basis: 100%; }
    .dl__btn { width: 100%; justify-content: center; }

    .dl__card,
    .dl__card--has-cover { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
    .dl__card--has-cover .dl__cover { grid-row: auto; margin-bottom: .75rem; }
    .dl__card--has-cover .dl__card-meta,
    .dl__card--has-cover .dl__actions { grid-column: 1; width: 100%; }
    .dl__meta-row { justify-content: center; }
    .dl__buttons { justify-content: center; }
}

/* ---------------------------------------------------------------------------
   Content-style isolation.

   The widget is pasted into rich page/post content, where global rules such as
   `.page-content .rich-content img:not(...)` (width: 100%) outrank any plain
   class selector here. Cover art and typography therefore pin their own
   geometry so the card survives wherever the shortcode lands.
   --------------------------------------------------------------------------- */

.dl img.dl__cover {
    display: block !important;
    width: 110px !important;
    height: 110px !important;
    max-width: 110px !important;
    min-width: 110px !important;
    margin: 0 !important;
    float: none !important;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: none;
}

.dl .dl__card-meta {
    min-width: 0;
    max-width: 100%;
}

.dl .dl__title,
.dl .dl__subtitle,
.dl .dl__note,
.dl .dl__item-title,
.dl .dl__meta-row {
    float: none;
    text-transform: none;
    letter-spacing: normal;
}

.dl .dl__title {
    margin: 0 0 .5rem !important;
    padding: 0;
    font-size: 1.6rem;
    line-height: 1.3;
    border: 0;
}

.dl .dl__subtitle   { margin: 0 0 1.5rem !important; }
.dl .dl__note       { margin: 1rem 0 0 !important; }
.dl .dl__item-title { margin: 0 0 .35rem !important; line-height: 1.4; }
.dl .dl__meta-row   { margin: 0 0 .2rem !important; line-height: 1.4; }
.dl .dl__form       { margin: 0 !important; }

@media (max-width: 575px) {
    .dl img.dl__cover {
        width: 150px !important;
        height: 150px !important;
        max-width: 150px !important;
        min-width: 150px !important;
        margin: 0 auto !important;
    }
}

/* Instagram keeps its gradient mark rather than a flat accent. */
.dl--instagram .dl__input-icon {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Format list: headline buttons, with the long tail behind a toggle. */
.dl__download span {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.25;
}

.dl__download-note {
    font-size: .72rem;
    font-weight: 500;
    opacity: .8;
}

.dl__more {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-top: .6rem;
    padding: .35rem .75rem;
    border: 0;
    border-radius: 50px;
    background: transparent;
    color: var(--text-light, #6c757d);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition, all .3s ease);
}

.dl__more:hover { color: var(--dl-accent); }

.dl__buttons--extra {
    margin-top: .5rem;
    padding-top: .6rem;
    border-top: 1px dashed var(--border-color, #e0e0e0);
}

.dl__buttons--extra .dl__download {
    padding: .45rem .9rem;
    font-size: .82rem;
}

@media (max-width: 575px) {
    .dl__more { align-self: center; }
}

/* ------------------------------------------------------------------------
   Hero variant: the homepage cover (Cover Style 2) renders the widget
   straight onto its gradient, so the card chrome goes and the text turns
   light. The result card keeps its own light background for legibility.
   ------------------------------------------------------------------------ */
.dl--hero {
    max-width: 760px;
    margin: 0 auto;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.dl--hero .dl__title {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 800;
    line-height: 1.15;
    color: #ffffff;
    margin-bottom: .75rem;
}

.dl--hero .dl__subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, .92);
}

.dl--hero .dl__input-wrap {
    background: #ffffff;
    border: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .25);
}

.dl--hero .dl__input-wrap:focus-within {
    box-shadow: 0 8px 32px rgba(0, 0, 0, .25), 0 0 0 3px rgba(255, 255, 255, .45);
}

.dl--hero .dl__note {
    color: rgba(255, 255, 255, .8);
}

.dl--hero .dl__result {
    text-align: left;
}

/* ------------------------------------------------------------------------
   Hero result: glassmorphism card over the cover gradient, with each format
   as a full-width row (label left, filename right). The headline format is
   a solid white row; the rest are frosted.
   ------------------------------------------------------------------------ */
.dl--hero .dl__card {
    padding: 1.25rem;
    gap: 0 1.25rem;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .32);
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .12);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.dl--hero .dl__card--has-cover .dl__cover { grid-row: auto; }
.dl--hero .dl__card--has-cover .dl__actions { grid-column: 1 / -1; }

.dl--hero .dl__card-meta { align-self: center; }

.dl--hero .dl__item-title { color: #ffffff; }

.dl--hero .dl__meta-row { color: rgba(255, 255, 255, .85); }

.dl--hero .dl__buttons {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: .6rem;
    margin-top: 1.1rem;
}

.dl--hero .dl__download {
    display: flex;
    width: 100%;
    justify-content: flex-start;
    gap: .75rem;
    padding: .8rem 1.1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, .14);
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
    text-align: left;
}

.dl--hero .dl__download:hover:not(:disabled) {
    filter: none;
    background: rgba(255, 255, 255, .24);
}

/* The headline format: solid white, so the obvious choice reads first. */
.dl--hero .dl__buttons:not(.dl__buttons--extra) .dl__download--primary:first-child {
    background: #ffffff;
    color: #1a1a1a;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
}

.dl--hero .dl__buttons:not(.dl__buttons--extra) .dl__download--primary:first-child:hover:not(:disabled) {
    background: #f4f4f4;
}

.dl--hero .dl__download > span { flex: 0 1 auto; min-width: 0; }

.dl--hero .dl__download-file {
    display: block;
    margin-left: auto;
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .78rem;
    font-weight: 400;
    opacity: .8;
}

.dl--hero .dl__buttons--extra {
    border-top-color: rgba(255, 255, 255, .3);
}

.dl--hero .dl__buttons--extra .dl__download { padding: .65rem 1.1rem; }

.dl--hero .dl__more { color: rgba(255, 255, 255, .9); }
.dl--hero .dl__more:hover { color: #ffffff; }

/* Loading and error states sit on the same frosted surface. */
.dl--hero .dl__loading {
    background: rgba(255, 255, 255, .14);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, .32);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

@media (max-width: 575px) {
    .dl--hero .dl__card-meta { text-align: center; }
    .dl--hero .dl__download-file { display: none; }
}
