/* =========================================================
   CDL Footer (v3.1 — clean design, matches header v4)
   Cambiador Letras — indigo
   ---------------------------------------------------------
   1. Footer layout
   2. Back to top button
   3. Share button
   4. Responsive
   5. Dark theme
   6. Reduced motion
   7. Material icons + polish
   Same class names, same HTML, same JS hooks.
   ========================================================= */


/* =========================================================
   1. FOOTER
   ========================================================= */

.cdl-footbar {
    --cdl-ft-a: #4F46E5;
    --cdl-ft-b: #818CF8;
    --cdl-ft-c: #38BDF8;
    --cdl-ft-tint: rgba(79, 70, 229, 0.07);
    --cdl-ft-tint-strong: rgba(79, 70, 229, 0.15);
    --cdl-ft-glow: rgba(79, 70, 229, 0.30);

    position: relative;
    margin-top: 72px;

    border-top: 1px solid var(--cdl-clr-border, #e2e8f0);
    background-color: var(--cdl-clr-surface, #ffffff);
    background-image: radial-gradient(
        80% 70% at 50% 0%,
        var(--cdl-ft-tint) 0%,
        transparent 65%
    );
}


/* Hairline brand gradient along the top edge (matches the header) */
.cdl-footbar::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -1px;
    height: 2px;

    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--cdl-ft-a) 25%,
        var(--cdl-ft-b) 60%,
        var(--cdl-ft-c) 85%,
        transparent 100%
    );
    opacity: 0.55;
    pointer-events: none;
}


/* Two columns on desktop: brand | navigation. Bottom bar spans both. */
.cdl-footbar__inner {
    width: min(
        calc(100% - 32px),
        var(--cdl-container-page, 1200px)
    );
    margin-inline: auto;
    padding: 52px 0 24px;

    display: grid;
    grid-template-columns: minmax(240px, 5fr) 7fr;
    column-gap: 56px;
    row-gap: 32px;
    align-items: start;
}


/* ---------- Brand ---------- */

.cdl-footbar__brand {
    max-width: 440px;
    margin: 0;
}

.cdl-footbar__logo {
    display: inline-block;
    margin-bottom: 14px;

    color: var(--cdl-ft-a);
    font-size: 1.5rem;
    font-weight: var(--cdl-font-weight-extrabold, 800);
    letter-spacing: -0.02em;
    line-height: 1.1;
    text-decoration: none;
}

@supports (-webkit-background-clip: text) or (background-clip: text) {

    .cdl-footbar__logo {
        background: linear-gradient(
            90deg,
            var(--cdl-ft-a) 0%,
            var(--cdl-ft-b) 100%
        );
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        color: transparent;
    }

}

.cdl-footbar__logo:hover {
    filter: brightness(1.1);
}

.cdl-footbar__logo:focus-visible {
    outline: 2px solid var(--cdl-ft-a);
    outline-offset: 4px;
    border-radius: var(--cdl-radius-md, 12px);
}

.cdl-footbar__description {
    max-width: 420px;
    margin: 0;
    padding-left: 14px;

    border-left: 2px solid transparent;
    border-image: linear-gradient(
        180deg,
        var(--cdl-ft-a),
        var(--cdl-ft-b)
    ) 1;

    color: var(--cdl-clr-text-muted, #64748b);
    font-size: 0.94rem;
    line-height: 1.75;
}


/* ---------- Navigation — plain links, underline on hover ---------- */

.cdl-footbar__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 2px;
    padding: 0;
    border: 0;
}

.cdl-footbar__nav a {
    position: relative;

    display: inline-flex;
    align-items: center;

    min-height: 38px;
    padding: 0 13px;

    border-radius: 10px;

    color: var(--cdl-clr-text-muted, #64748b);
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;

    transition:
        color var(--cdl-transition-fast, 0.15s ease),
        background var(--cdl-transition-fast, 0.15s ease);
}

/* Underline marker — grows from the centre (same as header) */
.cdl-footbar__nav a::after {
    content: "";

    position: absolute;
    left: 13px;
    right: 13px;
    bottom: 3px;

    height: 2px;
    border-radius: 2px;
    background: linear-gradient(
        90deg,
        var(--cdl-ft-a),
        var(--cdl-ft-b)
    );

    opacity: 0;
    transform: scaleX(0);
    transform-origin: center;

    transition: transform 0.22s ease, opacity 0.22s ease;
}

.cdl-footbar__nav a:hover {
    color: var(--cdl-ft-a);
    background: var(--cdl-ft-tint);
}

.cdl-footbar__nav a:hover::after {
    opacity: 1;
    transform: scaleX(1);
}

.cdl-footbar__nav a:focus-visible {
    outline: 2px solid var(--cdl-ft-a);
    outline-offset: 2px;
}


/* ---------- Bottom bar ---------- */

.cdl-footbar__bottom {
    grid-column: 1 / -1;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    margin-top: 4px;
    padding-top: 22px;

    border-top: 1px solid var(--cdl-clr-border, #e2e8f0);

    color: var(--cdl-clr-text-muted, #64748b);
    font-size: 0.82rem;
    line-height: 1.6;
}

.cdl-footbar__bottom p {
    margin: 0;
    color: inherit;
}


/* =========================================================
   2. BACK TO TOP
   ========================================================= */

#cdl-back-to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 999;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--cdl-ft-a), var(--cdl-ft-b));
    color: #ffffff;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 22px -8px var(--cdl-ft-glow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .25s, transform .25s, visibility .25s, filter .2s, box-shadow .2s;
}

#cdl-back-to-top.cdl-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#cdl-back-to-top:hover {
    filter: brightness(1.1);
    box-shadow: 0 14px 26px -8px var(--cdl-ft-glow);
}

#cdl-back-to-top:active {
    transform: translateY(0) scale(0.95);
}

#cdl-back-to-top:focus-visible {
    outline: 3px solid var(--cdl-ft-a);
    outline-offset: 3px;
}


/* =========================================================
   3. SHARE
   ========================================================= */

.cdl-share {
    position: fixed;
    right: 20px;
    bottom: 76px;
    z-index: 999;
}


/* ---------- Toggle button ---------- */

#cdl-share-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border: 1px solid var(--cdl-ft-tint-strong);
    border-radius: 12px;
    background: var(--cdl-clr-surface, #ffffff);
    color: var(--cdl-ft-a);
    cursor: pointer;
    box-shadow: 0 10px 22px -12px var(--cdl-ft-glow);
    transition:
        transform .2s,
        background .2s,
        border-color .2s,
        color .2s;
}

#cdl-share-toggle:hover {
    transform: translateY(-2px);
    background: var(--cdl-ft-tint);
    border-color: var(--cdl-ft-a);
}

#cdl-share-toggle[aria-expanded="true"] {
    background: var(--cdl-ft-tint-strong);
    border-color: var(--cdl-ft-a);
}

#cdl-share-toggle:focus-visible {
    outline: 3px solid var(--cdl-ft-a);
    outline-offset: 3px;
}


/* ---------- Menu ---------- */

.cdl-share__menu {
    position: absolute;
    right: 0;
    bottom: 56px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 200px;
    padding: 8px;
    border: 1px solid var(--cdl-ft-tint-strong);
    border-radius: 16px;
    background: var(--cdl-clr-surface, #ffffff);
    box-shadow: 0 20px 40px -16px var(--cdl-ft-glow);
    transform-origin: bottom right;
    animation: cdl-ft-pop 0.16s ease-out;
}

.cdl-share__menu[hidden] {
    display: none;
}

.cdl-share__item {
    display: block;
    width: 100%;
    padding: 11px 14px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--cdl-clr-text, #222222);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}

.cdl-share__item:hover,
.cdl-share__item:focus-visible {
    background: var(--cdl-ft-tint);
    color: var(--cdl-ft-a);
    outline: none;
}

/* "Copiar enlace" separated as the last action */
.cdl-share__item:last-child {
    margin-top: 4px;
    border-top: 1px solid var(--cdl-clr-border, #e2e8f0);
    border-radius: 0 0 10px 10px;
    padding-top: 13px;
}

@keyframes cdl-ft-pop {

    from {
        opacity: 0;
        transform: translateY(6px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

}


/* =========================================================
   4. RESPONSIVE
   ========================================================= */

@media (max-width: 860px) {

    .cdl-footbar__inner {
        grid-template-columns: 1fr;
        row-gap: 26px;
    }

    .cdl-footbar__brand {
        max-width: 520px;
    }

    .cdl-footbar__description {
        max-width: 480px;
    }

}

@media (max-width: 640px) {

    .cdl-footbar {
        margin-top: 52px;
    }

    .cdl-footbar__inner {
        padding-top: 38px;
    }

    .cdl-footbar__bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    #cdl-back-to-top {
        right: 14px;
        bottom: 14px;
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .cdl-share {
        right: 14px;
        bottom: 66px;
    }

    #cdl-share-toggle {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .cdl-share__menu {
        bottom: 54px;
    }
}

@media (max-width: 400px) {

    .cdl-footbar__inner {
        width: calc(100% - 20px);
    }

    .cdl-footbar__nav {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4px;
    }

    .cdl-footbar__nav a {
        justify-content: flex-start;
        font-size: 0.84rem;
        padding: 0 10px;
    }

    .cdl-footbar__nav a::after {
        left: 10px;
        right: 10px;
    }
}


/* =========================================================
   5. DARK THEME
   Lighter brand colours for contrast.
   ========================================================= */

[data-theme="dark"] .cdl-footbar,
.dark .cdl-footbar {
    --cdl-ft-a: #A5B4FC;
    --cdl-ft-b: #C7D2FE;
    --cdl-ft-c: #7DD3FC;
    --cdl-ft-tint: rgba(165, 180, 252, 0.10);
    --cdl-ft-tint-strong: rgba(165, 180, 252, 0.22);
    --cdl-ft-glow: rgba(0, 0, 0, 0.6);

    border-top-color: var(--cdl-clr-border, #272e45);
    background-color: var(--cdl-clr-surface, #141826);
}

/* Dark mode: no dotted pattern, keep the background plain */
[data-theme="dark"] .cdl-footbar::after,
.dark .cdl-footbar::after {
    display: none;
}

[data-theme="dark"] .cdl-footbar__bottom,
.dark .cdl-footbar__bottom {
    border-top-color: var(--cdl-clr-border, #272e45);
}

[data-theme="dark"] .cdl-share__item:last-child,
.dark .cdl-share__item:last-child {
    border-top-color: var(--cdl-clr-border, #272e45);
}

/* Gradient button is light in dark mode, so its icon goes dark */
[data-theme="dark"] #cdl-back-to-top,
.dark #cdl-back-to-top {
    color: #0B0E1F;
}


/* =========================================================
   6. REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .cdl-footbar__nav a,
    .cdl-footbar__nav a::after,
    .cdl-share__item,
    #cdl-back-to-top,
    #cdl-share-toggle {
        transition: none;
    }

    .cdl-share__menu {
        animation: none;
    }

    #cdl-share-toggle:hover {
        transform: none;
    }
}


/* =========================================================
   7. MATERIAL ICONS + POLISH (CSS only — HTML unchanged)
   Needs Material Symbols Rounded with icon_names including:
   apps, arrow_upward, auto_awesome, content_paste, draw,
   font_download, gavel, info, lock, mail, palette
   ========================================================= */

.cdl-footbar__logo::before,
.cdl-footbar__nav a::before,
.cdl-footbar__bottom p:last-child::before,
#cdl-back-to-top::before {
    font-family: "Material Symbols Rounded";
    font-weight: 500;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    direction: ltr;

    -webkit-font-smoothing: antialiased;
    -webkit-font-feature-settings: "liga";
    font-feature-settings: "liga";
}


/* Soft dotted pattern fading out from the top (light mode only) */
.cdl-footbar::after {
    content: "";
    position: absolute;
    inset: 2px 0 auto 0;
    height: 220px;

    background-image: radial-gradient(
        var(--cdl-ft-tint-strong) 1.2px,
        transparent 1.7px
    );
    background-size: 22px 22px;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
    opacity: 0.45;
    pointer-events: none;
}

.cdl-footbar__inner {
    position: relative;
    z-index: 1;
}


/* Brand: icon + live "fancy text" sample chip */
.cdl-footbar__logo::before {
    content: "auto_awesome"; content: "auto_awesome" / "";
    display: inline-block;
    margin-right: 8px;
    font-size: 1.3em;
    vertical-align: -0.2em;

    background: none;
    -webkit-text-fill-color: var(--cdl-ft-b);
    color: var(--cdl-ft-b);
}

.cdl-footbar__brand::after {
    content: "ℂ𝕒𝕞𝕓𝕚𝕒𝕕𝕠𝕣 𝕕𝕖 𝕃𝕖𝕥𝕣𝕒𝕤 ♡";
    content: "ℂ𝕒𝕞𝕓𝕚𝕒𝕕𝕠𝕣 𝕕𝕖 𝕃𝕖𝕥𝕣𝕒𝕤 ♡" / "";

    display: block;
    width: fit-content;
    margin-top: 18px;
    padding: 7px 16px;

    border: 1px solid var(--cdl-ft-tint-strong);
    border-radius: 999px;
    background: var(--cdl-clr-surface, #ffffff);

    color: var(--cdl-ft-a);
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}


/* Navigation icons */
.cdl-footbar__nav a::before {
    margin-right: 7px;
    font-size: 18px;
    color: var(--cdl-ft-a);
}

.cdl-footbar__nav a[href="/tools.html"]::before                       { content: "apps"; content: "apps" / ""; }
.cdl-footbar__nav a[href="/cambiador-de-texto.html"]::before { content: "auto_awesome"; content: "auto_awesome" / ""; }
.cdl-footbar__nav a[href="/cambiador-de-letras-cursivas.html"]::before           { content: "font_download"; content: "font_download" / ""; }
.cdl-footbar__nav a[href="/modelos-de-letras-bonitas.html"]::before    { content: "palette"; content: "palette" / ""; }
.cdl-footbar__nav a[href="/medieval-letras.html"]::before { content: "draw"; content: "draw" / ""; }
.cdl-footbar__nav a[href="/about.html"]::before                        { content: "info"; content: "info" / ""; }
.cdl-footbar__nav a[href="/contact.html"]::before                      { content: "mail"; content: "mail" / ""; }
.cdl-footbar__nav a[href="/privacy-policy.html"]::before                      { content: "lock"; content: "lock" / ""; }
.cdl-footbar__nav a[href="/disclaimer.html"]::before                   { content: "gavel"; content: "gavel" / ""; }


/* Hierarchy: tools = main links, info/legal (last 4) = quieter links */
.cdl-footbar__nav a:nth-last-child(-n+4) {
    min-height: 34px;
    padding: 0 10px;

    font-size: 0.84rem;
    font-weight: 500;
}

.cdl-footbar__nav a:nth-last-child(-n+4)::after {
    left: 10px;
    right: 10px;
}

.cdl-footbar__nav a:nth-last-child(-n+4)::before {
    font-size: 16px;
    opacity: 0.8;
}


/* Bottom bar chip (only the icon paragraph — keeps spaces in the copyright line) */
.cdl-footbar__bottom p:last-child {
    display: inline-flex;
    align-items: center;
}

.cdl-footbar__bottom p:last-child::before {
    content: "content_paste"; content: "content_paste" / "";
    margin-right: 6px;
    font-size: 16px;
    color: var(--cdl-ft-a);
}


/* Back to top — Material arrow instead of the ↑ character */
#cdl-back-to-top {
    font-size: 0;
}

#cdl-back-to-top::before {
    content: "arrow_upward"; content: "arrow_upward" / "";
    font-size: 24px;
}