.glossary-body {
    background:
        radial-gradient(ellipse 70% 50% at 50% 0%, rgba(31, 191, 228, 0.14) 0%, transparent 55%),
        linear-gradient(180deg, #f4fbff 0%, #f7fafc 30%, #f2f6fb 100%);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== HERO ===== */

.glossary-hero {
    padding: 88px 0 42px;
}

.glossary-hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.95fr);
    gap: 48px;
    align-items: center;
}

.glossary-hero-left {
    display: flex;
    flex-direction: column;
    gap: 32px;
    min-width: 0;
}

.glossary-hero-copy {
    max-width: 640px;
}

.glossary-hero-copy .eyebrow {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(31, 191, 228, 0.12);
    color: var(--site-cyan-strong);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.glossary-hero-copy h1 {
    margin: 16px 0 16px;
    color: var(--site-navy);
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 3.4vw, 3.6rem);
    line-height: 1.02;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #0a1a3a 0%, #1a3a5f 60%, #1fbfe4 130%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.glossary-hero-copy p {
    margin: 0;
    max-width: 720px;
    color: var(--site-muted);
    font-size: 1.02rem;
    line-height: 1.75;
}

/* ===== SEARCH ===== */

.glossary-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 760px;
    padding: 10px 14px 10px 58px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(9, 27, 52, 0.08);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 24px 60px -20px rgba(4, 17, 42, 0.2),
        0 0 0 6px rgba(255, 255, 255, 0.5);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.glossary-search:focus-within {
    border-color: rgba(31, 191, 228, 0.45);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 28px 72px -18px rgba(31, 191, 228, 0.35),
        0 0 0 6px rgba(31, 191, 228, 0.1);
    transform: translateY(-1px);
}

.glossary-search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    color: var(--site-cyan-strong);
    pointer-events: none;
}

.glossary-search-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.glossary-search input {
    flex: 1;
    min-width: 0;
    padding: 14px 4px;
    border: 0;
    background: transparent;
    color: var(--site-navy);
    font-size: 1.04rem;
    font-weight: 500;
    outline: none;
    font-family: inherit;
}

.glossary-search input::placeholder {
    color: rgba(9, 27, 52, 0.42);
    font-weight: 500;
}

.glossary-search input::-webkit-search-decoration,
.glossary-search input::-webkit-search-cancel-button,
.glossary-search input::-webkit-search-results-button,
.glossary-search input::-webkit-search-results-decoration {
    display: none;
}

.glossary-search-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: rgba(9, 27, 52, 0.06);
    color: var(--site-navy);
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.glossary-search-clear:hover,
.glossary-search-clear:focus-visible {
    background: var(--site-cyan);
    color: #ffffff;
    transform: rotate(90deg);
    outline: none;
}

.glossary-search-clear svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
}

.glossary-search-count {
    flex-shrink: 0;
    padding-right: 6px;
    color: var(--site-cyan-strong);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.glossary-search-count:empty {
    display: none;
}

/* ===== LAYOUT ===== */

.glossary-shell {
    padding: 0 0 110px;
}

.glossary-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 40px;
    align-items: start;
}

.glossary-content {
    display: grid;
    gap: 12px;
    min-width: 0;
}

/* ===== SECTIONS ===== */

.glossary-section {
    position: relative;
    border: 1px solid rgba(9, 27, 52, 0.06);
    border-radius: 24px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 252, 255, 0.94));
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 18px 48px -24px rgba(4, 17, 42, 0.18),
        0 8px 22px -14px rgba(31, 191, 228, 0.06);
    backdrop-filter: blur(10px);
    scroll-margin-top: 120px;
    overflow: hidden;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.glossary-section[hidden] {
    display: none;
}

.glossary-section[open] {
    border-color: rgba(31, 191, 228, 0.25);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 28px 72px -28px rgba(4, 17, 42, 0.26),
        0 14px 36px -14px rgba(31, 191, 228, 0.18);
}

.glossary-section > summary {
    list-style: none;
    cursor: pointer;
}

.glossary-section > summary::-webkit-details-marker {
    display: none;
}

.glossary-section > summary:focus-visible {
    outline: 2px solid rgba(31, 191, 228, 0.55);
    outline-offset: -2px;
}

.glossary-section-head {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto auto;
    gap: 14px;
    align-items: center;
    padding: 12px 18px;
    margin: 0;
    transition: background 0.3s ease;
}

.glossary-section > summary:hover .glossary-section-head,
.glossary-section > summary:focus-visible .glossary-section-head {
    background: linear-gradient(90deg, rgba(31, 191, 228, 0.05), transparent 70%);
}

.glossary-section-head-text {
    min-width: 0;
}

.glossary-section-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 22px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(31, 191, 228, 0.12);
    color: var(--site-cyan-strong);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.glossary-section-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(9, 27, 52, 0.05);
    color: var(--site-navy);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease, color 0.3s ease;
}

.glossary-section[open] .glossary-section-chevron {
    transform: rotate(180deg);
    background: var(--site-cyan);
    color: #ffffff;
}

.glossary-section-chevron svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.glossary-section-body {
    padding: 4px 26px 28px;
    border-top: 1px solid rgba(9, 27, 52, 0.05);
    margin-top: 2px;
    animation: glossaryReveal 0.35s ease;
}

@keyframes glossaryReveal {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0);    }
}

.glossary-section-kicker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: linear-gradient(140deg, #ffffff 0%, #eaf7fd 100%);
    color: var(--site-cyan-strong);
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 10px 22px -8px rgba(31, 191, 228, 0.4),
        0 0 0 1px rgba(31, 191, 228, 0.18);
}

.glossary-section-head h2 {
    margin: 0 0 2px;
    color: var(--site-navy);
    font-family: var(--font-display);
    font-size: 1rem;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.glossary-section-head p {
    margin: 0;
    max-width: 720px;
    color: var(--site-muted);
    font-size: 0.74rem;
    line-height: 1.55;
}

/* ===== WIDGETS ===== */

.glossary-widgets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.glossary-widget {
    position: relative;
    height: 100%;
    padding: 20px 22px;
    border: 1px solid rgba(9, 27, 52, 0.07);
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(244, 250, 255, 0.92));
    box-shadow: 0 8px 22px -12px rgba(4, 17, 42, 0.1);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.glossary-widget::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--site-cyan), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.glossary-widget:hover {
    transform: translateY(-2px);
    border-color: rgba(31, 191, 228, 0.35);
    box-shadow: 0 16px 36px -14px rgba(31, 191, 228, 0.28);
}

.glossary-widget:hover::before {
    opacity: 1;
}

.glossary-widget[hidden] {
    display: none;
}

.glossary-widget h3 {
    margin: 0 0 10px;
    color: var(--site-navy);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: -0.005em;
}

.glossary-widget p {
    margin: 0;
    color: var(--site-muted);
    font-size: 0.84rem;
    line-height: 1.72;
}

.glossary-section-empty {
    margin: 10px 0 0;
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(9, 27, 52, 0.03);
    color: var(--site-muted);
    font-size: 0.82rem;
    font-style: italic;
}

.glossary-empty {
    margin: 20px 0 0;
    padding: 42px 32px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px dashed rgba(31, 191, 228, 0.4);
    text-align: center;
}

.glossary-empty strong {
    display: block;
    margin-bottom: 8px;
    color: var(--site-navy);
    font-family: var(--font-display);
    font-size: 1.2rem;
}

.glossary-empty span {
    display: block;
    color: var(--site-muted);
    font-size: 0.92rem;
}

/* ===== SIDEBAR ===== */

.glossary-sidebar {
    position: sticky;
    top: 120px;
    padding: 28px 22px;
    background: linear-gradient(180deg, #0a1f3f 0%, #081331 60%, #050e24 100%);
    border: 0;
    border-radius: 0;
    box-shadow:
        0 30px 80px -30px rgba(4, 17, 42, 0.45),
        0 0 0 1px rgba(31, 191, 228, 0.08) inset;
    overflow: hidden;
}

.glossary-sidebar::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--site-cyan), transparent);
}

.glossary-sidebar::after {
    content: "";
    position: absolute;
    top: -40%;
    right: -40%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(31, 191, 228, 0.18), transparent 70%);
    filter: blur(20px);
    pointer-events: none;
}

.glossary-sidebar-label {
    position: relative;
    margin: 0 0 18px;
    padding-bottom: 14px;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.glossary-sidebar-nav {
    position: relative;
    display: grid;
    gap: 2px;
}

.glossary-sidebar-nav a {
    position: relative;
    display: block;
    padding: 12px 14px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: color 0.25s ease, background 0.25s ease, border-color 0.25s ease, padding 0.25s ease, opacity 0.3s ease;
}

.glossary-sidebar-nav a::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 0;
    height: 2px;
    background: var(--site-cyan);
    transform: translateY(-50%);
    transition: width 0.3s ease;
}

.glossary-sidebar-nav a:hover,
.glossary-sidebar-nav a:focus-visible {
    background: rgba(31, 191, 228, 0.08);
    color: #ffffff;
    border-left-color: var(--site-cyan);
    padding-left: 18px;
    outline: none;
}

.glossary-sidebar-nav a:hover::before,
.glossary-sidebar-nav a:focus-visible::before {
    width: 6px;
}

.glossary-sidebar-nav a.is-dim {
    opacity: 0.3;
    pointer-events: none;
}

/* ===== WORD CLOUD ===== */

.glossary-cloud {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px 14px;
    min-height: 360px;
    padding: 20px 10px;
}

.cloud-word {
    --tilt: 0deg;
    --ty: 0px;
    display: inline-block;
    padding: 4px 6px;
    margin: 0;
    border: 0;
    background: transparent;
    color: var(--site-cyan);
    font-family: var(--font-display, inherit);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.005em;
    cursor: pointer;
    transform: rotate(var(--tilt)) translateY(var(--ty));
    transition: color 0.25s ease, transform 0.3s cubic-bezier(0.3, 0.9, 0.4, 1.3), text-shadow 0.25s ease;
    opacity: 0;
    animation: cloudFadeIn 0.6s ease forwards;
    animation-delay: calc(var(--i, 0) * 40ms);
    white-space: nowrap;
}

.cloud-word:hover,
.cloud-word:focus-visible {
    color: var(--site-navy);
    transform: rotate(var(--tilt)) translateY(var(--ty)) scale(1.12);
    text-shadow: 0 0 16px rgba(31, 191, 228, 0.45);
    outline: none;
}

.cloud-word:focus-visible {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

.cloud-size-xl { font-size: 1.75rem; font-weight: 800; }
.cloud-size-lg { font-size: 1.3rem;  font-weight: 800; }
.cloud-size-md { font-size: 1rem;    font-weight: 700; }
.cloud-size-sm { font-size: 0.8rem;  font-weight: 700; }
.cloud-size-xs { font-size: 0.66rem; font-weight: 600; }

.cloud-tilt-1 { --tilt: -4deg; --ty: 2px;  }
.cloud-tilt-2 { --tilt: -1deg; --ty: -3px; }
.cloud-tilt-3 { --tilt:  0deg; --ty: 1px;  }
.cloud-tilt-4 { --tilt:  2deg; --ty: -2px; }
.cloud-tilt-5 { --tilt:  4deg; --ty: 3px;  }

@keyframes cloudFadeIn {
    from { opacity: 0; transform: rotate(var(--tilt)) translateY(calc(var(--ty) + 8px)); }
    to   { opacity: 1; transform: rotate(var(--tilt)) translateY(var(--ty));             }
}

/* Highlight flash cuando se llega desde la nube */
.glossary-widget.is-highlighted {
    animation: glossaryWidgetFlash 1.8s ease;
}

@keyframes glossaryWidgetFlash {
    0% {
        background: rgba(31, 191, 228, 0.18);
        box-shadow: 0 0 0 3px rgba(31, 191, 228, 0.55), 0 20px 40px -14px rgba(31, 191, 228, 0.5);
        transform: translateY(-2px);
    }
    100% {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(244, 250, 255, 0.92));
        box-shadow: 0 8px 22px -12px rgba(4, 17, 42, 0.1);
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cloud-word {
        opacity: 1;
        animation: none;
    }
    .glossary-widget.is-highlighted {
        animation: none;
        outline: 3px solid var(--site-cyan);
        outline-offset: 2px;
    }
}

/* ===== RESPONSIVE ===== */

@media (max-width: 1199.98px) {
    .glossary-hero-inner {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .glossary-cloud {
        min-height: auto;
        padding: 10px 0 4px;
    }

    .glossary-layout {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .glossary-sidebar {
        position: static;
        order: -1;
        padding: 20px 18px;
    }

    .glossary-sidebar-nav {
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        overflow-x: auto;
        padding-bottom: 6px;
        scrollbar-width: thin;
        scrollbar-color: rgba(31, 191, 228, 0.4) transparent;
    }

    .glossary-sidebar-nav::-webkit-scrollbar {
        height: 6px;
    }

    .glossary-sidebar-nav::-webkit-scrollbar-thumb {
        background: rgba(31, 191, 228, 0.4);
        border-radius: 6px;
    }

    .glossary-sidebar-nav a {
        flex-shrink: 0;
        white-space: nowrap;
        border-left: 0;
        border-bottom: 2px solid transparent;
        padding: 10px 14px;
    }

    .glossary-sidebar-nav a::before {
        display: none;
    }

    .glossary-sidebar-nav a:hover,
    .glossary-sidebar-nav a:focus-visible {
        padding-left: 14px;
        border-left: 0;
        border-bottom-color: var(--site-cyan);
    }
}

@media (max-width: 991.98px) {
    .glossary-hero {
        padding: 64px 0 32px;
    }

    .glossary-hero-copy h1 {
        font-size: clamp(2rem, 5vw, 2.8rem);
    }

    .glossary-section {
        border-radius: 22px;
    }

    .glossary-section-head {
        grid-template-columns: 48px minmax(0, 1fr) auto;
        gap: 16px;
        padding: 18px 20px;
    }

    .glossary-section-count {
        display: none;
    }

    .glossary-section-body {
        padding: 4px 20px 22px;
    }

    .glossary-section-kicker {
        width: 48px;
        height: 48px;
        border-radius: 14px;
        font-size: 0.88rem;
    }

    .glossary-section-head h2 {
        font-size: 1.18rem;
    }
}

@media (max-width: 767.98px) {
    .glossary-hero {
        padding: 48px 0 24px;
    }

    .glossary-hero-inner {
        gap: 26px;
    }

    .glossary-cloud {
        display: none;
    }

    .glossary-hero-copy h1 {
        font-size: clamp(1.9rem, 7vw, 2.3rem);
    }

    .glossary-hero-copy p {
        font-size: 0.94rem;
        line-height: 1.7;
    }

    .glossary-search {
        padding: 8px 10px 8px 50px;
        gap: 8px;
        border-radius: 18px;
    }

    .glossary-search-icon {
        left: 16px;
        width: 22px;
        height: 22px;
    }

    .glossary-search-icon svg {
        width: 20px;
        height: 20px;
    }

    .glossary-search input {
        padding: 12px 2px;
        font-size: 0.96rem;
    }

    .glossary-search-clear {
        width: 34px;
        height: 34px;
    }

    .glossary-search-count {
        display: none;
    }

    .glossary-shell {
        padding-bottom: 72px;
    }

    .glossary-section {
        border-radius: 20px;
    }

    .glossary-section-head {
        grid-template-columns: 42px minmax(0, 1fr) auto;
        gap: 12px;
        padding: 16px 16px;
    }

    .glossary-section-body {
        padding: 4px 16px 20px;
    }

    .glossary-section-chevron {
        width: 32px;
        height: 32px;
    }

    .glossary-section-kicker {
        width: 42px;
        height: 42px;
        border-radius: 12px;
        font-size: 0.78rem;
    }

    .glossary-section-head h2 {
        font-size: 1.08rem;
    }

    .glossary-section-head p {
        font-size: 0.8rem;
        line-height: 1.65;
    }

    .glossary-widgets {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .glossary-widget {
        padding: 16px 17px;
        border-radius: 16px;
    }

    .glossary-widget h3 {
        font-size: 0.94rem;
    }

    .glossary-widget p {
        font-size: 0.8rem;
        line-height: 1.68;
    }

    .glossary-sidebar {
        padding: 16px 14px;
    }

    .glossary-sidebar-label {
        margin-bottom: 12px;
        padding-bottom: 10px;
        font-size: 0.64rem;
    }

    .glossary-sidebar-nav a {
        font-size: 0.76rem;
        padding: 9px 12px;
    }

    .glossary-empty {
        padding: 32px 22px;
        border-radius: 22px;
    }

    .glossary-empty strong {
        font-size: 1.05rem;
    }

    .glossary-empty span {
        font-size: 0.86rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .glossary-search,
    .glossary-search-clear,
    .glossary-widget,
    .glossary-sidebar-nav a {
        transition: none;
    }
}
