.nomos-timeline {
    --nt-normal: #fff;
    --nt-featured: #e9f4ff;
    --nt-current: #ffd966;
    --nt-accent: #1f5f99;
    --nt-border: rgba(15, 31, 48, .14);
    --nt-line-size: 4px;
    --nt-marker-size: 24px;
    --nt-shadow: 0 12px 30px rgba(15, 31, 48, .12);
    font-family: inherit;
}

.nomos-timeline *,
.nomos-timeline *::before,
.nomos-timeline *::after {
    box-sizing: border-box;
}

.nomos-timeline__track {
    display: flex;
    position: relative;
    gap: 1rem;
}

/* Contenitore di scorrimento della vista orizzontale. Le frecce laterali
   sono anche aree sensibili: mantenendo il puntatore sopra una freccia la
   timeline continua a scorrere nella relativa direzione. */
.nomos-timeline__rail {
    position: relative;
    min-width: 0;
    isolation: isolate;
}

.nomos-timeline__viewport {
    position: relative;
    z-index: 1;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    overscroll-behavior-inline: contain;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Nasconde la barra di scorrimento nativa senza disattivare lo scroll.
   Restano disponibili frecce, trascinamento touch, rotella/trackpad e API JS. */
.nomos-timeline__viewport::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

/* La linea e il centro dei segnaposto condividono esattamente la stessa
   coordinata verticale. Il track ha una larghezza propria, così la linea
   accompagna tutti i box anche quando sono fuori dalla porzione visibile. */
.nomos-timeline--horizontal .nomos-timeline__track {
    width: max-content;
    min-width: 100%;
    align-items: stretch;
    padding: .25rem 3.75rem 48px;
}

.nomos-timeline--horizontal .nomos-timeline__track::after {
    position: absolute;
    bottom: 18px;
    left: var(--nt-line-left, 4rem);
    z-index: 0;
    width: var(--nt-line-width, calc(100% - 8rem));
    height: var(--nt-line-size);
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--nt-accent) 55%, #fff),
        var(--nt-accent) 12%,
        var(--nt-accent) 88%,
        color-mix(in srgb, var(--nt-accent) 55%, #fff)
    );
    box-shadow: 0 2px 8px color-mix(in srgb, var(--nt-accent) 22%, transparent);
    content: "";
}

.nomos-timeline__scroll {
    position: absolute;
    top: 0;
    bottom: 8px;
    z-index: 8;
    display: flex;
    width: 58px;
    margin: 0;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 0;
    color: var(--nt-accent);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, filter .2s ease;
}

.nomos-timeline.has-horizontal-overflow .nomos-timeline__scroll {
    opacity: 1;
    pointer-events: auto;
}

.nomos-timeline__scroll--previous {
    left: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, .98) 20%, rgba(255, 255, 255, .76) 58%, transparent);
}

.nomos-timeline__scroll--next {
    right: 0;
    background: linear-gradient(270deg, rgba(255, 255, 255, .98) 20%, rgba(255, 255, 255, .76) 58%, transparent);
}

.nomos-timeline__scroll-icon {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--nt-accent) 30%, transparent);
    border-radius: 50%;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 6px 18px rgba(15, 31, 48, .16);
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.nomos-timeline__scroll:hover .nomos-timeline__scroll-icon,
.nomos-timeline__scroll:focus-visible .nomos-timeline__scroll-icon {
    background: #fff;
    box-shadow: 0 8px 24px color-mix(in srgb, var(--nt-accent) 26%, transparent);
    transform: scale(1.08);
}

.nomos-timeline__scroll:focus-visible {
    outline: 0;
}

.nomos-timeline__scroll:focus-visible .nomos-timeline__scroll-icon {
    outline: 3px solid color-mix(in srgb, var(--nt-accent) 35%, transparent);
    outline-offset: 2px;
}

.nomos-timeline.has-horizontal-overflow .nomos-timeline__scroll:disabled {
    opacity: .25;
    cursor: default;
    filter: grayscale(.45);
    pointer-events: none;
}

.nomos-timeline__item {
    position: relative;
    z-index: 1;
    flex: 1 0 210px;
    min-height: 112px;
    margin: 0;
    padding: 1rem;
    border: 1px solid var(--nt-border);
    border-radius: 14px;
    background: var(--nt-normal);
    box-shadow: 0 5px 18px rgba(15, 31, 48, .07);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.nomos-timeline--horizontal .nomos-timeline__item {
    flex: 0 0 clamp(210px, 24vw, 290px);
}

.nomos-timeline__item:hover,
.nomos-timeline__item:focus-visible,
.nomos-timeline__item.is-active {
    border-color: var(--nt-accent);
    box-shadow: var(--nt-shadow);
    transform: translateY(-4px);
}

.nomos-timeline__item:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--nt-accent) 35%, transparent);
    outline-offset: 3px;
}

.nomos-timeline__item.is-featured {
    background: var(--nt-featured);
}

.nomos-timeline__item.is-current {
    background: var(--nt-current);
}

.nomos-timeline__date,
.nomos-timeline__title {
    display: block;
}

.nomos-timeline__line-break {
    display: none;
}


.nomos-timeline__date-part {
    white-space: nowrap;
}

.nomos-timeline__date-separator {
    display: inline-block;
    margin: 0 .28rem;
    opacity: .7;
}

.nomos-timeline__date {
    margin-bottom: .5rem;
    color: var(--nt-accent);
    font-size: .86rem;
    font-weight: 700;
    line-height: 1.25;
}

.nomos-timeline__title {
    font-weight: 750;
    line-height: 1.3;
}

/* Il segnaposto usa un elemento interno separato dalla linea principale.
   Nella vista orizzontale il tratto è orizzontale a riposo e ruota in
   verticale quando il relativo box diventa attivo. */
.nomos-timeline__marker {
    position: absolute;
    z-index: 2;
    display: grid;
    width: var(--nt-marker-size);
    height: var(--nt-marker-size);
    place-items: center;
    overflow: visible;
    border: 3px solid var(--nt-accent);
    border-radius: 50%;
    background: #fff;
    box-shadow:
        0 0 0 4px #fff,
        0 4px 12px color-mix(in srgb, var(--nt-accent) 34%, transparent);
    transition: transform .24s ease, box-shadow .24s ease, border-color .24s ease;
}

.nomos-timeline__marker::before {
    position: absolute;
    top: 50%;
    left: 50%;
    width: calc(var(--nt-marker-size) - 6px);
    height: var(--nt-line-size);
    border-radius: 999px;
    background: var(--nt-accent);
    content: "";
    transform: translate(-50%, -50%) rotate(0deg);
    transform-origin: center;
    transition: transform .34s cubic-bezier(.2, .8, .2, 1), width .34s ease;
}

.nomos-timeline__marker::after {
    position: absolute;
    inset: -7px;
    border: 2px solid color-mix(in srgb, var(--nt-accent) 55%, transparent);
    border-radius: 50%;
    content: "";
    opacity: 0;
    pointer-events: none;
    transform: scale(.72);
}

.nomos-timeline__item:hover .nomos-timeline__marker,
.nomos-timeline__item:focus-visible .nomos-timeline__marker,
.nomos-timeline__item.is-active .nomos-timeline__marker {
    box-shadow:
        0 0 0 4px #fff,
        0 0 0 7px color-mix(in srgb, var(--nt-accent) 18%, transparent),
        0 5px 14px color-mix(in srgb, var(--nt-accent) 42%, transparent);
}

.nomos-timeline__item.is-active .nomos-timeline__marker {
    animation: nomos-marker-pop .48s cubic-bezier(.2, .85, .25, 1);
}

.nomos-timeline__item.is-active .nomos-timeline__marker::after {
    animation: nomos-marker-ring .62s ease-out;
}

.nomos-timeline--horizontal .nomos-timeline__marker {
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
}

.nomos-timeline--horizontal .nomos-timeline__item:hover .nomos-timeline__marker,
.nomos-timeline--horizontal .nomos-timeline__item:focus-visible .nomos-timeline__marker {
    transform: translateX(-50%) scale(1.06);
}

.nomos-timeline--horizontal .nomos-timeline__item.is-active .nomos-timeline__marker {
    transform: translateX(-50%) scale(1.1);
}

.nomos-timeline--horizontal .nomos-timeline__item.is-active .nomos-timeline__marker::before {
    transform: translate(-50%, -50%) rotate(90deg);
}

@keyframes nomos-marker-pop {
    0% {
        scale: 1;
    }
    42% {
        scale: 1.22;
    }
    72% {
        scale: .96;
    }
    100% {
        scale: 1;
    }
}

@keyframes nomos-marker-ring {
    0% {
        opacity: .72;
        transform: scale(.72);
    }
    100% {
        opacity: 0;
        transform: scale(1.55);
    }
}

.nomos-timeline__content {
    min-width: 0;
    margin-top: 1.5rem;
    padding: clamp(1.25rem, 3vw, 2.5rem);
    border: 1px solid var(--nt-border);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 12px 35px rgba(15, 31, 48, .09);
}

.nomos-timeline__panel[hidden] {
    display: none;
}

.nomos-timeline__panel:focus {
    outline: none;
}

.nomos-timeline__meta {
    margin: 0 0 1.2rem;
    padding-left: 1rem;
    border-left: 4px solid var(--nt-accent);
    color: #555;
    font-size: 1.05rem;
    line-height: 1.55;
}

.nomos-timeline__content-title {
    margin-top: 0;
}

.nomos-timeline__article::after {
    display: block;
    clear: both;
    content: "";
}

.nomos-timeline__link {
    display: inline-flex;
    align-items: center;
    margin-top: 1rem;
    font-weight: 700;
}

.nomos-timeline--vertical {
    display: grid;
    grid-template-columns: minmax(240px, 35%) minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}

.nomos-timeline--vertical .nomos-timeline__track {
    flex-direction: column;
    padding-left: 42px;
}

.nomos-timeline--vertical .nomos-timeline__track::before {
    position: absolute;
    top: 1rem;
    bottom: 1rem;
    left: 14px;
    width: var(--nt-line-size);
    border-radius: 999px;
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--nt-accent) 55%, #fff),
        var(--nt-accent) 12%,
        var(--nt-accent) 88%,
        color-mix(in srgb, var(--nt-accent) 55%, #fff)
    );
    box-shadow: 2px 0 8px color-mix(in srgb, var(--nt-accent) 22%, transparent);
    content: "";
}

.nomos-timeline--vertical .nomos-timeline__item {
    flex: none;
    width: 100%;
    min-height: auto;
}

.nomos-timeline--vertical .nomos-timeline__item:hover,
.nomos-timeline--vertical .nomos-timeline__item:focus-visible,
.nomos-timeline--vertical .nomos-timeline__item.is-active {
    transform: translateX(4px);
}

.nomos-timeline--vertical .nomos-timeline__marker {
    top: 50%;
    left: -38px;
    transform: translateY(-50%);
}

.nomos-timeline--vertical .nomos-timeline__marker::before {
    width: var(--nt-line-size);
    height: calc(var(--nt-marker-size) - 6px);
}

.nomos-timeline--vertical .nomos-timeline__item:hover .nomos-timeline__marker,
.nomos-timeline--vertical .nomos-timeline__item:focus-visible .nomos-timeline__marker,
.nomos-timeline--vertical .nomos-timeline__item.is-active .nomos-timeline__marker {
    transform: translateY(-50%) scale(1.08);
}

.nomos-timeline--vertical .nomos-timeline__content {
    position: sticky;
    top: 1rem;
    margin-top: 0;
}

@media (max-width: 767.98px) {
    .nomos-timeline--horizontal .nomos-timeline__track {
        padding-right: 3.25rem;
        padding-left: 3.25rem;
    }

    .nomos-timeline__scroll {
        width: 50px;
    }

    .nomos-timeline__scroll-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .nomos-timeline--vertical {
        display: block;
    }

    .nomos-timeline--vertical .nomos-timeline__track {
        padding-left: 42px;
    }

    .nomos-timeline--vertical .nomos-timeline__content {
        position: static;
        margin-top: 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nomos-timeline__item,
    .nomos-timeline__marker,
    .nomos-timeline__marker::before,
    .nomos-timeline__scroll,
    .nomos-timeline__scroll-icon {
        transition: none;
    }

    .nomos-timeline__item.is-active .nomos-timeline__marker,
    .nomos-timeline__item.is-active .nomos-timeline__marker::after {
        animation: none;
    }
}
