/**
 * Sitemap — Bento Detail Grid
 * Sfondo differenziato, card bianche in risalto, focus blur + drawer.
 */

.sitemap-bento-shell {
    position: relative;
    margin-top: 2rem;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    border-radius: 24px;
    background: linear-gradient(135deg, #f5f7ff 0%, #e0e7ff 100%);
    border: 1px solid rgba(108, 93, 211, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

/* Variante scura opzionale */
.sitemap-bento-shell.sitemap-bento-shell--dark {
    background: linear-gradient(145deg, #0f172a 0%, #1e1b4b 55%, #312e81 100%);
    border-color: rgba(129, 140, 248, 0.25);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.sitemap-bento-shell.sitemap-bento-shell--dark .sitemap-bento-intro {
    color: #c7d2fe;
}

.sitemap-bento-intro-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.sitemap-bento-intro {
    font-size: 0.95rem;
    color: var(--text-secondary, #475569);
    margin: 0;
    max-width: 42rem;
    line-height: 1.55;
    flex: 1;
}

.sitemap-bento-theme-btn {
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(108, 93, 211, 0.35);
    background: rgba(255, 255, 255, 0.7);
    color: var(--primary, #5b4dc4);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.sitemap-bento-theme-btn:hover {
    background: #fff;
    border-color: var(--primary, #6c5dd3);
}

.sitemap-bento-shell.sitemap-bento-shell--dark .sitemap-bento-theme-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #e0e7ff;
    border-color: rgba(199, 210, 254, 0.35);
}

/* Card con dettaglio bento */
.content-card--bento {
    cursor: pointer;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.35s ease,
        border-color 0.25s ease,
        filter 0.35s ease;
}

.content-card--bento:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(108, 93, 211, 0.2);
    border-color: var(--primary, #6c5dd3);
}

.content-card--bento:focus-visible {
    outline: 2px solid var(--primary, #6c5dd3);
    outline-offset: 3px;
}

/* Focus: resto griglia attenuato / blur */
.sitemap-bento-shell.bento-focus-active .content-card {
    transition: filter 0.35s ease, opacity 0.35s ease, transform 0.35s ease;
}

.sitemap-bento-shell.bento-focus-active .content-card:not(.bento-card-selected) {
    filter: blur(3px);
    opacity: 0.52;
}

.sitemap-bento-shell.bento-focus-active .content-card.bento-card-selected {
    filter: none;
    opacity: 1;
    transform: translateY(-6px) scale(1.02);
    z-index: 2;
    box-shadow: 0 24px 48px rgba(108, 93, 211, 0.28);
    border-color: rgba(108, 93, 211, 0.45);
}

/* Backdrop */
.sitemap-bento-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.sitemap-bento-backdrop[hidden] {
    display: none !important;
}

/* Drawer */
.sitemap-bento-drawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    max-height: min(48vh, 520px);
    padding: 0 1rem 1rem;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    pointer-events: none;
}

.sitemap-bento-drawer[hidden] {
    display: none !important;
}

.sitemap-bento-drawer-inner {
    pointer-events: auto;
    width: 100%;
    max-width: 920px;
    background: #fff;
    border-radius: 20px 20px 12px 12px;
    border: 1px solid rgba(108, 93, 211, 0.18);
    box-shadow: 0 -12px 48px rgba(15, 23, 42, 0.18);
    padding: 1.35rem 1.5rem 1.5rem;
    position: relative;
    max-height: min(46vh, 500px);
    overflow-y: auto;
    animation: bentoDrawerUp 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes bentoDrawerUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sitemap-bento-drawer-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 50%;
    background: var(--gray-100, #f1f5f9);
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.sitemap-bento-drawer-close:hover {
    background: var(--primary-light, #ede9fe);
    color: var(--primary, #6c5dd3);
}

.bento-drawer-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.65rem;
    padding-right: 2.5rem;
}

.bento-drawer-tags .badge {
    font-size: 0.7rem;
}

.bento-drawer-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: var(--text-primary, #0f172a);
}

.bento-drawer-summary {
    font-size: 0.95rem;
    color: var(--text-secondary, #475569);
    line-height: 1.55;
    margin: 0 0 1rem;
}

.bento-drawer-kicker {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #94a3b8);
    margin-bottom: 0.35rem;
}

.bento-drawer-models p {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: var(--text-primary, #1e293b);
    line-height: 1.5;
}

.bento-drawer-list {
    margin: 0 0 1rem;
    padding-left: 1.2rem;
    font-size: 0.9rem;
    color: var(--text-secondary, #475569);
    line-height: 1.55;
}

.bento-drawer-list li {
    margin-bottom: 0.35rem;
}

.bento-drawer-io {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

@media (max-width: 640px) {
    .bento-drawer-io {
        grid-template-columns: 1fr;
    }
}

.bento-io-block {
    background: var(--gray-50, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
}

.bento-io-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary, #6c5dd3);
    margin-bottom: 0.35rem;
}

.bento-io-block p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-primary, #334155);
    line-height: 1.45;
}

.bento-drawer-cta {
    width: 100%;
    justify-content: center;
    text-align: center;
}

body.sitemap-bento-open {
    padding-bottom: min(46vh, 480px);
}

@media (prefers-reduced-motion: reduce) {
    .content-card--bento,
    .sitemap-bento-shell.bento-focus-active .content-card {
        transition: none;
    }

    .sitemap-bento-drawer-inner {
        animation: none;
    }
}
