/* =====================================================================
 * Botó i opcions d'accessibilitat (23/11/2026).
 *
 * Només es carrega si està activat a /admin/accessibilitat. El JS
 * (a11y-widget.js) i un script en línia al <head> posen classes a <html>
 * segons les preferències del visitant (localStorage `icavorA11y`):
 *
 *   a11y-themed + a11y-dark | a11y-contrast   tema fosc / alt contrast
 *   a11y-size-115 | -130 | -150               mida del text
 *   a11y-links  a11y-spacing  a11y-font  a11y-motion  a11y-focus
 *
 * El tema fosc canvia els tokens de variables.css i, per als colors que
 * els CSS tenen fixos, fa servir les regles GENERADES del final
 * (gen_dark.py). El contingut del TinyMCE porta colors en línia: es
 * neutralitzen amb !important només dins de .page__content.
 * ===================================================================== */

/* ---------------------------------------------------------------- temes */
html.a11y-dark {
    --a11y-bg:        #121417;
    --a11y-surface:   #1c1f25;
    --a11y-surface-2: #252a31;
    --a11y-text:      #d2d5da;
    --a11y-strong:    #f2f3f5;
    --a11y-muted:     #b6bac1;
    --a11y-link:      #ff9e9e;
    --a11y-link-hover:#ffc7c7;
    --a11y-heading:   #ff9e9e;
    --a11y-border:    #5b616b;
    --a11y-focus:     #ffffff;
}
html.a11y-contrast {
    --a11y-bg:        #000000;
    --a11y-surface:   #000000;
    --a11y-surface-2: #000000;
    --a11y-text:      #ffffff;
    --a11y-strong:    #ffffff;
    --a11y-muted:     #ffffff;
    --a11y-link:      #ffff3c;
    --a11y-link-hover:#ffffff;
    --a11y-heading:   #ffffff;
    --a11y-border:    #ffffff;
    --a11y-focus:     #ffff3c;
}
html.a11y-themed {
    color-scheme: dark;
    --color-bg:            var(--a11y-bg);
    --color-surface:       var(--a11y-surface);
    --color-border:        var(--a11y-border);
    --color-border-strong: var(--a11y-border);
    --color-text:          var(--a11y-text);
    --color-text-muted:    var(--a11y-muted);
    --color-text-strong:   var(--a11y-strong);
    --color-focus:         var(--a11y-focus);
    background-color: var(--a11y-bg);
}

/* ------------------------------------------------------- mida del text */
html.a11y-size-115 { font-size: 115%; }
html.a11y-size-130 { font-size: 130%; }
html.a11y-size-150 { font-size: 150%; }
/* Etiquetes posades a sobre de les imatges (data, categoria): mida fixa,
   perquè amb text gran o més espaiat no es trepitgin. */
html:is(.a11y-size-115, .a11y-size-130, .a11y-size-150, .a11y-spacing) :is(.featured-card__category, .featured-card__date, .news-card__date) {
    font-size: 12px !important;
    letter-spacing: 0.02em !important;
    word-spacing: normal !important;
    line-height: 1.3 !important;
}

/* ------------------------------------------------- subratllar enllaços */
html.a11y-links a,
html.a11y-contrast a {
    text-decoration: underline !important;
    text-underline-offset: 0.15em;
}

/* ---------------------------------- espaiat del text (WCAG 1.4.12) */
html.a11y-spacing .site-main,
html.a11y-spacing .site-main * {
    line-height: 1.6 !important;
    letter-spacing: 0.12em !important;
    word-spacing: 0.16em !important;
}
html.a11y-spacing .site-main p {
    margin-bottom: 2em !important;
}

/* ------------------------------------------------ lletra més llegible */
html.a11y-font {
    --font-base:    Verdana, Tahoma, "Segoe UI", Arial, sans-serif;
    --font-heading: Verdana, Tahoma, "Segoe UI", Arial, sans-serif;
    --fw-thin:  400;
    --fw-light: 400;
}
html.a11y-font body,
html.a11y-font .page__content * {
    font-family: Verdana, Tahoma, "Segoe UI", Arial, sans-serif !important;
}

/* ---------------------------------------------- aturar animacions */
html.a11y-motion *,
html.a11y-motion *::before,
html.a11y-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

/* --------------------------------------------- focus ben visible */
html.a11y-focus :focus-visible {
    outline: 3px solid #ffbf47 !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 6px #0b0c0c !important;
}

/* =====================================================================
 * Botó flotant i panell
 * ===================================================================== */
.a11yw {
    --a11yw-offset: 0px; /* l'augmenta el JS si el banner de cookies és visible */
    position: fixed;
    bottom: calc(16px + var(--a11yw-offset));
    right: 16px;
    z-index: 9100; /* per sobre del banner de cookies (9000) */
    font-family: "Roboto", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 16px; /* el panell no creix amb la mida del text de la pàgina */
    letter-spacing: normal !important;
    word-spacing: normal !important;
    line-height: 1.4;
}
.a11yw--left { right: auto; left: 16px; }

.a11yw__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: #c80010;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.a11yw__toggle:hover { background: #95020e; }
.a11yw__toggle:focus-visible {
    outline: 3px solid #1a1a1a;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px #ffffff;
}
.a11yw__toggle svg { width: 30px; height: 30px; display: block; }

.a11yw__panel {
    position: absolute;
    bottom: 64px;
    right: 0;
    width: min(360px, calc(100vw - 32px));
    max-height: calc(100vh - 110px - var(--a11yw-offset));
    overflow-y: auto;
    background: #ffffff;
    color: #1a1a1a;
    border: 1px solid #c0c2c8;
    border-top: 4px solid #c80010;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    padding: 16px 18px 18px;
}
.a11yw--left .a11yw__panel { right: auto; left: 0; }
.a11yw__panel[hidden] { display: none; }

.a11yw__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.a11yw__title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: normal;
    text-transform: none;
}
.a11yw__close {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #c0c2c8;
    border-radius: 50%;
    background: #ffffff;
    color: #1a1a1a;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.a11yw__close:focus-visible,
.a11yw__panel input:focus-visible,
.a11yw__reset:focus-visible,
.a11yw__link:focus-visible {
    outline: 3px solid #1a1a1a;
    outline-offset: 2px;
}

.a11yw__group {
    border: 0;
    margin: 12px 0 0;
    padding: 0;
    min-width: 0;
}
.a11yw__legend {
    padding: 0;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
}
.a11yw__options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 6px;
}
.a11yw__opt {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 6px 10px;
    border: 1px solid #c0c2c8;
    border-radius: 6px;
    background: #ffffff;
    color: #1a1a1a;
    font-size: 14px;
    cursor: pointer;
}
.a11yw__opt:has(input:checked) {
    border-color: #c80010;
    background: #fdf3f4;
    box-shadow: inset 0 0 0 1px #c80010;
}
.a11yw__opt input {
    width: 18px;
    height: 18px;
    margin: 0;
    flex: none;
    accent-color: #c80010;
}
.a11yw__checks {
    display: grid;
    gap: 6px;
}

.a11yw__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e3e3e3;
}
.a11yw__reset {
    min-height: 40px;
    padding: 6px 14px;
    border: 1px solid #1a1a1a;
    border-radius: 6px;
    background: #ffffff;
    color: #1a1a1a;
    font-size: 14px;
    cursor: pointer;
}
.a11yw__link {
    color: #95020e;
    font-size: 14px;
    text-decoration: underline;
}
.a11yw__note {
    width: 100%;
    margin: 0;
    font-size: 12.5px;
    color: #4a4d55;
}

/* El panell també es veu fosc quan el tema és fosc. */
html.a11y-themed .a11yw__panel,
html.a11y-themed .a11yw__close,
html.a11y-themed .a11yw__opt,
html.a11y-themed .a11yw__reset {
    background: var(--a11y-surface);
    color: var(--a11y-strong);
    border-color: var(--a11y-border);
}
html.a11y-themed .a11yw__panel { border-top-color: #c80010; }
html.a11y-themed .a11yw__title,
html.a11y-themed .a11yw__legend { color: var(--a11y-strong); }
html.a11y-themed .a11yw__opt:has(input:checked) {
    background: var(--a11y-surface-2);
    border-color: var(--a11y-link);
    box-shadow: inset 0 0 0 1px var(--a11y-link);
}
html.a11y-themed .a11yw__link { color: var(--a11y-link); }
html.a11y-themed .a11yw__note { color: var(--a11y-muted); }
html.a11y-themed .a11yw__foot { border-top-color: var(--a11y-border); }
html.a11y-themed .a11yw__close:focus-visible,
html.a11y-themed .a11yw__panel input:focus-visible,
html.a11y-themed .a11yw__reset:focus-visible,
html.a11y-themed .a11yw__link:focus-visible { outline-color: var(--a11y-focus); }

@media print {
    .a11yw { display: none !important; }
}
/* ---- GENERAT per gen_dark.py a partir de base/pages/home/templates/a11y.css (23/11/2026).
   Respecta els @media originals. Si canvien aquells CSS, torneu-lo a generar
   o reviseu el tema fosc amb axe. ---- */
html.a11y-themed body,
html.a11y-themed th,
html.a11y-themed blockquote,
html.a11y-themed pre,
html.a11y-themed code,
html.a11y-themed input, html.a11y-themed select, html.a11y-themed textarea,
html.a11y-themed .site-header,
html.a11y-themed .site-header__top,
html.a11y-themed .site-header__nav .submenu,
html.a11y-themed .site-header__nav .submenu .menu-link:hover,
html.a11y-themed .site-header__search,
html.a11y-themed .cookie-banner,
html.a11y-themed .cookie-banner__btn,
html.a11y-themed .cookie-banner__btn:hover,
html.a11y-themed .cookie-banner__option,
html.a11y-themed .auth-gate,
html.a11y-themed .directori__cercador,
html.a11y-themed .contacte-form,
html.a11y-themed .error-404__card,
html.a11y-themed .hero-featured,
html.a11y-themed .featured-card,
html.a11y-themed .featured-card__media,
html.a11y-themed .featured-card__date,
html.a11y-themed .lawyer-search,
html.a11y-themed .lawyer-search__form input, html.a11y-themed .lawyer-search__form select,
html.a11y-themed .news-section,
html.a11y-themed .news-slider__btn,
html.a11y-themed .news-card,
html.a11y-themed .news-card__media,
html.a11y-themed .page__content table tbody tr:nth-child(even),
html.a11y-themed .junta-table tbody tr:hover,
html.a11y-themed .avantatges-table tbody tr:nth-child(even),
html.a11y-themed .directori-search,
html.a11y-themed .directori-search input, html.a11y-themed .directori-search select,
html.a11y-themed .directori-list__avatar,
html.a11y-themed .directori-list__num,
html.a11y-themed .colegiat-card,
html.a11y-themed .colegiat-card__avatar,
html.a11y-themed .colegiat-section,
html.a11y-themed .colegiat-legal,
html.a11y-themed .colegiat-tags li,
html.a11y-themed .user-widget,
html.a11y-themed .perfil-section,
html.a11y-themed .pricing-card,
html.a11y-themed .news-categories-bar__item:hover,
html.a11y-themed .iframe-form,
html.a11y-themed .page__content .cols-4 > *,
html.a11y-themed .page__content .quota-card,
html.a11y-themed .page__content details, html.a11y-themed .page__content .e-n-accordion-item,
html.a11y-themed .page__content details > summary, html.a11y-themed .page__content .e-n-accordion-item-title,
html.a11y-themed .page__content details > summary:hover {
    background-color: var(--a11y-surface);
}
html.a11y-themed h1, html.a11y-themed h2, html.a11y-themed h3, html.a11y-themed h4, html.a11y-themed h5, html.a11y-themed h6,
html.a11y-themed a,
html.a11y-themed a:hover, html.a11y-themed a:focus-visible,
html.a11y-themed .site-header__social a,
html.a11y-themed .site-header__utility a,
html.a11y-themed .site-header__nav .submenu .menu-link,
html.a11y-themed .site-header__nav .submenu .menu-link:hover,
html.a11y-themed .site-header__search button,
html.a11y-themed .cookie-banner__text strong,
html.a11y-themed .cookie-banner__text a,
html.a11y-themed .cookie-banner__btn,
html.a11y-themed .page__title,
html.a11y-themed .page__content h2,
html.a11y-themed .page__content h3,
html.a11y-themed .page__content a:not(.btn),
html.a11y-themed .page__content a:hover,
html.a11y-themed .auth-gate__notice strong,
html.a11y-themed .junta-membres .membre__carrec,
html.a11y-themed .error-404__code,
html.a11y-themed .error-404__card-title,
html.a11y-themed .error-404__card-arrow,
html.a11y-themed .featured-card__title,
html.a11y-themed .featured-card__title a:hover,
html.a11y-themed .lawyer-search__title,
html.a11y-themed .news-section__heading,
html.a11y-themed .news-section__link:hover, html.a11y-themed .news-section__link:focus-visible,
html.a11y-themed .news-slider__btn,
html.a11y-themed .news-card__title,
html.a11y-themed .news-card__title a:hover,
html.a11y-themed .news-card__more a,
html.a11y-themed .news-card__more a:hover,
html.a11y-themed .junta-table .junta-table__chair,
html.a11y-themed .avantatges-table .check,
html.a11y-themed .directori-list__name a:hover,
html.a11y-themed .directori-list__especialitats,
html.a11y-themed .colegiat-card__avatar,
html.a11y-themed .colegiat-card__name,
html.a11y-themed .colegiat-legal__label,
html.a11y-themed .colegiat-section__title,
html.a11y-themed .colegiat-meta dd a,
html.a11y-themed .colegiat-junta-rol,
html.a11y-themed .perfil-breadcrumb,
html.a11y-themed .perfil-breadcrumb a,
html.a11y-themed .hub-section__title,
html.a11y-themed .user-widget__links a:hover,
html.a11y-themed .user-widget__links a::before,
html.a11y-themed .user-widget__logout button,
html.a11y-themed .user-widget__logout button:hover,
html.a11y-themed .hub-news__title,
html.a11y-themed .hub-news__title a:hover,
html.a11y-themed .hub-news__more a:hover,
html.a11y-themed .perfil-section__title,
html.a11y-themed .perfil-links a,
html.a11y-themed .perfil-links a:hover,
html.a11y-themed .lloguer-cols__title,
html.a11y-themed .pricing-card__features li::before,
html.a11y-themed .news-breadcrumb a,
html.a11y-themed .news-category__title,
html.a11y-themed .news-categories-bar__item,
html.a11y-themed .pagination__item,
html.a11y-themed .page__content .cols-4 h3, html.a11y-themed .page__content .cols-4 h4,
html.a11y-themed .page__content .quota-card h4,
html.a11y-themed .page__content .dossier-list li::before,
html.a11y-themed .page__content .dossier-list a:hover,
html.a11y-themed .page__content details > summary::after, html.a11y-themed .page__content .e-n-accordion-item-title::after,
html.a11y-themed .news-sidebar__title,
html.a11y-themed .news-sidebar__item a:hover .news-sidebar__item-title,
html.a11y-themed .search-results__title,
html.a11y-themed .search-results__link:hover,
html.a11y-themed .news-slider__pause:hover {
    color: var(--a11y-link);
}
html.a11y-themed input, html.a11y-themed select, html.a11y-themed textarea,
html.a11y-themed .site-footer__credits a,
html.a11y-themed .featured-card__title a,
html.a11y-themed .news-section__link,
html.a11y-themed .news-card__title a,
html.a11y-themed .directori-list__name a,
html.a11y-themed .hub-news__title a {
    color: var(--a11y-strong);
}
html.a11y-contrast button, html.a11y-contrast .btn, html.a11y-contrast input[type="submit"],
html.a11y-contrast .site-header__social a:hover,
html.a11y-contrast .site-header__lang,
html.a11y-contrast .site-header__lang:hover,
html.a11y-contrast .featured-card__category,
html.a11y-contrast .lawyer-search__submit,
html.a11y-contrast .news-slider__btn:hover:not(:disabled),
html.a11y-contrast .news-card__date,
html.a11y-contrast .page__content table thead th, html.a11y-contrast .page__content table tbody tr:first-child th,
html.a11y-contrast .junta-table thead th,
html.a11y-contrast .avantatges-table thead th,
html.a11y-contrast .directori-list__action,
html.a11y-contrast .directori-list__action:hover,
html.a11y-contrast .hub-tile__label,
html.a11y-contrast .hub-tile--highlighted .hub-tile__icon,
html.a11y-contrast .user-widget__header,
html.a11y-contrast .user-widget__logout-icon,
html.a11y-contrast .pricing-card__header,
html.a11y-contrast .news-categories-bar__item.is-active,
html.a11y-contrast .pagination__item:hover,
html.a11y-contrast .page__content .quota-badge {
    background: #000000 !important; box-shadow: inset 0 0 0 1px #ffffff;
}
html.a11y-themed button, html.a11y-themed .btn, html.a11y-themed input[type="submit"],
html.a11y-themed .site-header__social a:hover,
html.a11y-themed .site-header__lang,
html.a11y-themed .site-header__lang:hover,
html.a11y-themed .featured-card__category,
html.a11y-themed .lawyer-search__submit,
html.a11y-themed .news-slider__btn:hover:not(:disabled),
html.a11y-themed .news-card__date,
html.a11y-themed .page__content table thead th, html.a11y-themed .page__content table tbody tr:first-child th,
html.a11y-themed .junta-table thead th,
html.a11y-themed .avantatges-table thead th,
html.a11y-themed .directori-list__action,
html.a11y-themed .directori-list__action:hover,
html.a11y-themed .hub-tile__label,
html.a11y-themed .hub-tile--highlighted .hub-tile__icon,
html.a11y-themed .user-widget__header,
html.a11y-themed .user-widget__logout-icon,
html.a11y-themed .pricing-card__header,
html.a11y-themed .news-categories-bar__item.is-active,
html.a11y-themed .pagination__item:hover,
html.a11y-themed .page__content .quota-badge {
    color: #ffffff;
}
@media (max-width: 900px) {
html.a11y-themed .site-header__nav,
html.a11y-themed .site-header__nav .submenu, html.a11y-themed .site-header__nav .submenu .submenu,
html.a11y-themed .site-header__nav .submenu .menu-link--disabled,
html.a11y-themed .site-header__nav .menu-link:active {
    background-color: var(--a11y-surface);
}
}
@media (max-width: 900px) {
html.a11y-themed .site-header__nav .menu-item--top > .menu-link, html.a11y-themed .site-header__nav .submenu .menu-link,
html.a11y-themed .site-header__nav .menu-item--top > .menu-link:hover, html.a11y-themed .site-header__nav .menu-item--top > .menu-link:focus, html.a11y-themed .site-header__nav .menu-item--top:focus-within > .menu-link {
    color: var(--a11y-link);
}
}

/* =====================================================================
 * Tema fosc / alt contrast: ajustos fets a mà (van DESPRÉS de les
 * regles generades perquè guanyin en cas d'empat).
 * ===================================================================== */
html.a11y-themed body {
    background-color: var(--a11y-bg);
    color: var(--a11y-text);
}
html.a11y-themed .site-main,
html.a11y-themed .page-banners,
html.a11y-themed .page-banner-bottom {
    background-color: var(--a11y-bg);
}
/* La barra vermella de la capçalera es manté: el text blanc hi té 6:1.
   La franja superior i el cercador passen al tema. */
html.a11y-themed .site-header__search input[type="search"] {
    color: var(--a11y-strong);
}
html.a11y-themed .site-header__search button {
    color: var(--a11y-link);
}
html.a11y-themed .site-header__utility li + li::before {
    color: var(--a11y-border);
}
/* Botons vermells amb text blanc: es queden vermells. */
html.a11y-themed .btn,
html.a11y-themed .lawyer-search__submit,
html.a11y-themed .cookie-banner__btn--primary {
    color: #ffffff;
}
/* Estils en línia de les plantilles amb el vermell corporatiu com a color
   de text (insígnies, missatges d'error): rosa clar sobre el fons fosc. */
html.a11y-themed [style*="color:var(--color-brand"]:not([style*="background:var(--color-brand"]):not([style*="background-color:var(--color-brand"]),
html.a11y-themed [style*="color: var(--color-brand"]:not([style*="background: var(--color-brand"]):not([style*="background-color: var(--color-brand"]) {
    color: var(--a11y-link) !important;
}
/* Placeholders i camps de formulari */
html.a11y-themed ::placeholder {
    color: var(--a11y-muted);
}
html.a11y-themed :is(input, select, textarea) {
    background-color: var(--a11y-surface-2);
    color: var(--a11y-strong);
    border-color: var(--a11y-border);
}

/* Contingut del TinyMCE: colors i fons en línia heretats d'Elementor. */
html.a11y-themed .page__content [style*="background"],
html.a11y-themed .page__content [bgcolor] {
    background-color: var(--a11y-surface-2) !important;
    background-image: none !important;
}
html.a11y-themed .page__content [style*="color"] {
    color: var(--a11y-text) !important;
}
html.a11y-themed .page__content :is(h1, h2, h3, h4, h5, h6),
html.a11y-themed .page__content :is(h1, h2, h3, h4, h5, h6)[style] {
    color: var(--a11y-heading) !important;
}
html.a11y-themed .page__content a,
html.a11y-themed .page__content a[style],
html.a11y-themed .page__content a[style] * {
    color: var(--a11y-link) !important;
}
html.a11y-themed .page__content a:hover {
    color: var(--a11y-link-hover) !important;
}
html.a11y-themed .page__content [style*="border"] {
    border-color: var(--a11y-border) !important;
}
html.a11y-themed .page__content :is(td, th) {
    border-color: var(--a11y-border);
}
html.a11y-themed .page__content hr {
    border-color: var(--a11y-border);
}

/* Alt contrast: res de grisos, vores visibles. */
html.a11y-contrast .site-main,
html.a11y-contrast .site-main * {
    color: #ffffff;
}
html.a11y-contrast .site-main a,
html.a11y-contrast .site-main a * {
    color: var(--a11y-link) !important;
}
html.a11y-contrast .site-main img {
    filter: none;
}
html.a11y-contrast :focus-visible {
    outline-color: var(--a11y-focus) !important;
}
