/* CF Glossary Tooltip — Cloudfactory S.r.l. — https://www.cloudfactory.it */

/* Link nel testo */
a.cf-glossary-link {
    color: inherit;
    text-decoration: none;
    border-bottom: none;
    font-weight: bold;
    cursor: pointer;
}
a.cf-glossary-link:hover {
    text-decoration: none;
    border-bottom: none;
}

/* Neutralizza esplicitamente dentro heading */
h1 a.cf-glossary-link,
h2 a.cf-glossary-link,
h3 a.cf-glossary-link,
h4 a.cf-glossary-link,
h5 a.cf-glossary-link,
h6 a.cf-glossary-link {
    font-weight: inherit;
    cursor: inherit;
    pointer-events: none;
}

/* Modal overlay */
.cf-glossary-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    inset: 0;
    z-index: 99999;
}
.cf-glossary-modal[hidden] {
    display: none;
}

.cf-glossary-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

/* Box */
.cf-glossary-modal__box {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: cf-glossary-in 0.18s ease;
}

@keyframes cf-glossary-in {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
.cf-glossary-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid #eee;
}

.cf-glossary-modal__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
}

.cf-glossary-modal__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: #888;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s;
    flex-shrink: 0;
}
.cf-glossary-modal__close:hover {
    color: #111;
}

/* Body */
.cf-glossary-modal__body {
    padding: 18px 20px;
    overflow-y: auto;
    flex: 1;
    font-size: 0.97rem;
    line-height: 1.6;
    color: #333;
}

.cf-glossary-modal__loading {
    color: #aaa;
    font-style: italic;
}

.cf-glossary-modal__content p:first-child {
    margin-top: 0;
}
.cf-glossary-modal__content p:last-child {
    margin-bottom: 0;
}

/* Footer */
.cf-glossary-modal__footer {
    padding: 12px 20px;
    border-top: 1px solid #eee;
    text-align: right;
}

.cf-glossary-modal__readmore {
    font-size: 0.85rem;
    color: #0073aa;
    text-decoration: none;
}
.cf-glossary-modal__readmore:hover {
    text-decoration: underline;
}

/* Focus trap */
.cf-glossary-modal__box:focus {
    outline: none;
}

/* Mobile */
@media (max-width: 480px) {
    .cf-glossary-modal__box {
        width: 95%;
        max-height: 90vh;
    }
}

/* ============================================================
   INDICE A-Z
   ============================================================ */
:root {
    --cf-blue:        #1a5fa8;
    --cf-blue-light:  #e8f0fc;
    --cf-blue-dark:   #134a85;
    --cf-bg:          #f4f6fb;
    --cf-card-bg:     #ffffff;
    --cf-text:        #1a1a2e;
    --cf-muted:       #6b7280;
    --cf-radius:      12px;
    --cf-shadow:      0 2px 12px rgba(26,95,168,.10);
}

.cf-glossary-index {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    padding: 24px 0 32px;
}

.cf-glossary-index__letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    border: 2px solid var(--cf-blue);
    color: var(--cf-blue);
    background: transparent;
    transition: background .15s, color .15s, border-color .15s, opacity .15s;
}

.cf-glossary-index__letter:hover:not(.is-empty) {
    background: var(--cf-blue);
    color: #fff;
    text-decoration: none;
}

.cf-glossary-index__letter.is-active {
    background: var(--cf-blue);
    color: #fff;
}

.cf-glossary-index__letter.is-empty {
    border-color: #d1d5db;
    color: #d1d5db;
    cursor: default;
    pointer-events: none;
}

/* ============================================================
   GLOSSARIO COMPLETO
   ============================================================ */
.cf-glossario-completo {
    padding: 0 0 48px;
}

.cf-glossario-completo__section {
    margin-bottom: 48px;
    scroll-margin-top: 100px;
}

.cf-glossario-completo__letter {
    font-size: 2rem;
    font-weight: 800;
    color: var(--cf-blue);
    border-bottom: 3px solid var(--cf-blue-light);
    padding-bottom: 8px;
    margin-bottom: 20px;
    line-height: 1.2;
}

.cf-glossario-completo__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.cf-glossario-card {
    background: var(--cf-card-bg);
    border-radius: var(--cf-radius);
    box-shadow: var(--cf-shadow);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: box-shadow .18s, transform .18s;
    border: 1px solid #e8edf5;
}

.cf-glossario-card:hover {
    box-shadow: 0 6px 24px rgba(26,95,168,.16);
    transform: translateY(-2px);
}

.cf-glossario-card__title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
}

.cf-glossario-card__title a {
    color: var(--cf-text);
    text-decoration: none;
}

.cf-glossario-card__title a:hover {
    color: var(--cf-blue);
}

.cf-glossario-card__excerpt {
    font-size: 0.875rem;
    color: var(--cf-muted);
    margin: 0;
    line-height: 1.55;
    flex: 1;
}

.cf-glossario-card__link {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--cf-blue);
    text-decoration: none;
    margin-top: 4px;
}

.cf-glossario-card__link:hover {
    text-decoration: underline;
}

/* ============================================================
   PAGINA SINGOLA voce_glossario — stile coerente
   ============================================================ */
.single-voce_glossario .entry-content,
.single-voce_glossario .elementor-widget-text-editor {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--cf-text);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
    .cf-glossary-index__letter {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
        border-radius: 6px;
    }
    .cf-glossario-completo__grid {
        grid-template-columns: 1fr;
    }
    .cf-glossario-completo__letter {
        font-size: 1.5rem;
    }
}

/* ============================================================
   PAGINA ARCHIVIO GLOSSARIO — layout hero + wrap
   ============================================================ */
.cf-glossario-page {
    background: var(--cf-bg, #f4f6fb);
    min-height: 60vh;
}

.cf-glossario-hero {
    background: linear-gradient(135deg, #1a5fa8 0%, #2176d2 100%);
    color: #fff;
    padding: 56px 24px 48px;
    text-align: center;
}

.cf-glossario-hero__inner {
    max-width: 760px;
    margin: 0 auto;
}

.cf-breadcrumb {
    font-size: 0.82rem;
    color: rgba(255,255,255,.75);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.cf-breadcrumb a {
    color: rgba(255,255,255,.85);
    text-decoration: none;
}

.cf-breadcrumb a:hover {
    color: #fff;
    text-decoration: underline;
}

.cf-glossario-hero__title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    margin: 0 0 12px;
    color: #fff;
    line-height: 1.15;
}

.cf-glossario-hero__desc {
    font-size: 1.05rem;
    color: rgba(255,255,255,.88);
    margin: 0;
    line-height: 1.6;
}

.cf-glossario-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}
