.toscana-numeri {
    --tin-gap: 2.5rem;
    --tin-fg: #1a1a1a;
    --tin-up: #1a8e3a;
    --tin-down: #c8102e;
    --tin-neutral: #555;
    --tin-pad-y: clamp(2rem, 5vw, 3.5rem);

    background: transparent;
    color: var(--tin-fg);
    padding: var(--tin-pad-y) 0;
    box-sizing: border-box;
}

.toscana-numeri *,
.toscana-numeri *::before,
.toscana-numeri *::after {
    box-sizing: inherit;
}

.toscana-numeri__inner {
    max-width: 1320px;
    margin: 0 auto;
}

.toscana-numeri__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2.25rem;
}

.toscana-numeri__title {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400;
    font-size: clamp(1.875rem, 3.2vw, 2.75rem);
    line-height: 1.1;
    margin: 0;
    padding: 0;
    color: inherit;
    text-transform: none;
}

.toscana-numeri__vedi-tutti {
    color: inherit;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    white-space: nowrap;
}

.toscana-numeri__vedi-tutti:hover,
.toscana-numeri__vedi-tutti:focus {
    text-decoration: underline;
}

.toscana-numeri__vedi-tutti > span {
    margin-left: .25em;
    font-weight: 700;
}

.toscana-numeri__carousel {
    position: relative;
}

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

.toscana-numeri__track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 2 * var(--tin-gap)) / 3);
    gap: var(--tin-gap);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding-bottom: .5rem;
    scrollbar-width: thin;
}

.toscana-numeri__track::-webkit-scrollbar { height: 6px; }
.toscana-numeri__track::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, .2);
    border-radius: 3px;
}

@media (max-width: 1024px) {
    .toscana-numeri__track { grid-auto-columns: calc((100% - var(--tin-gap)) / 2); }
}

@media (max-width: 640px) {
    .toscana-numeri__track { grid-auto-columns: 100%; }
}

.toscana-numeri__card {
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: transparent;
}

.toscana-numeri__card-head {
    margin-bottom: .35rem;
}

.toscana-numeri__card-title {
    /* override theme heading styles (theme defaults h3 to serif) */
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-style: normal;
    font-size: 1rem !important;
    /* !important: la regola del tema ".content h3" (font-weight 500) vince altrimenti per specificità */
    font-weight: 600 !important;
    line-height: 1.2;
    color: inherit;
    text-transform: none;
    letter-spacing: 0;
    margin: 0 0 .15rem !important;
    padding: 0;
}

.toscana-numeri__card-value {
    margin: 0;
    font-size: .9375rem;
    line-height: 1.25;
}

.toscana-numeri__card-value strong { font-weight: 700; }

.toscana-numeri__delta {
    display: inline-flex;
    align-items: center;
    gap: .25em;
    margin-left: .5em;
    font-weight: 700;
}

.toscana-numeri__delta--up { color: var(--tin-up); }
.toscana-numeri__delta--down { color: var(--tin-down); }
.toscana-numeri__delta--neutral { color: var(--tin-neutral); }

.toscana-numeri__chart {
    position: relative;
    width: 100%;
    height: 240px;
    overflow: hidden;
    background: #fff;
}

@media (max-width: 1024px) { .toscana-numeri__chart { height: 260px; } }
@media (max-width: 640px)  { .toscana-numeri__chart { height: 280px; } }

.toscana-numeri__canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.toscana-numeri__chart-loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    margin: 0;
    font-size: .85rem;
    color: rgba(0, 0, 0, .55);
    pointer-events: none;
}

.toscana-numeri__chart-loading--error { color: var(--tin-down); }

.toscana-numeri__xaxis {
    display: flex;
    justify-content: space-between;
    font-size: .8rem;
    color: rgba(0, 0, 0, .6);
    margin-top: .35rem;
}

.toscana-numeri__note {
    margin: .65rem 0 0;
    font-size: .8rem;
    line-height: 1.35;
    color: rgba(0, 0, 0, .65);
}

.toscana-numeri__card-source {
    margin: .35rem 0 0;
    font-size: .75rem;
    line-height: 1.35;
    font-style: italic;
    color: rgba(0, 0, 0, .55);
}

.toscana-numeri__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, .12);
    background: #fff;
    font-size: 1.5rem;
    line-height: 1;
    color: inherit;
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .1);
    transition: opacity .15s ease, transform .15s ease;
}

.toscana-numeri__nav:hover:not(:disabled) {
    transform: translateY(-50%) scale(1.05);
}

.toscana-numeri__nav:focus-visible {
    outline: 2px solid #005fcc;
    outline-offset: 3px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}

.toscana-numeri__vedi-tutti:focus-visible {
    outline: 2px solid #005fcc;
    outline-offset: 3px;
    border-radius: 2px;
}

.toscana-numeri__nav:disabled {
    opacity: 0;
    pointer-events: none;
}

.toscana-numeri__nav--prev { left: -1.375rem; }
.toscana-numeri__nav--next { right: -1.375rem; }

/* Pagination dots — desktop relies on the arrows, so hidden by default. */
.toscana-numeri__dots {
    display: none;
}

.toscana-numeri__dot {
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    margin: 0;
    width: 22px;
    height: 22px;
    padding: 6px;
    background-color: rgba(0, 0, 0, .25);
    background-clip: content-box;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color .15s ease, transform .15s ease;
}

.toscana-numeri__dot[aria-current="true"] {
    background-color: var(--tin-fg);
    transform: scale(1.25);
}

.toscana-numeri__dot:focus-visible {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

@media (max-width: 640px) {
    .toscana-numeri__nav { display: none; }
    .toscana-numeri { --tin-gap: 1.25rem; }
    .toscana-numeri__head { margin-bottom: 1.5rem; }

    .toscana-numeri__dots {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: .25rem;
        margin-top: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .toscana-numeri__track { scroll-behavior: auto; }
    .toscana-numeri__nav,
    .toscana-numeri__nav:hover:not(:disabled) {
        transition: none;
        transform: translateY(-50%);
    }
}
