/* History Timeline: stili di base. Il layout per dispositivo (orientamento, disposizione, posizione anno)
   è generato dal widget in un <style> con le media query dei breakpoint Elementor. */

.eht {
    --eht-per-view: 2;
    --eht-gap: 30px;
    --eht-line-color: #ccc;
    --eht-line-style: solid;
    --eht-line-width: 1px;
    --eht-marker-size: 24px;
    --eht-marker-color: #444;
    --eht-marker-offset: 20px;
    --eht-axis-offset: 0px;
    --eht-year-col: 80px;
    --eht-v-align: start;
    --eht-v-pad: 1;
    --eht-nav-space: 40px;
    --eht-peek-edges: 0;
    position: relative;
    box-sizing: border-box;
}

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

.eht-viewport {
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    outline: none;
}

.eht-viewport::-webkit-scrollbar {
    display: none;
}

.eht-viewport:focus-visible {
    outline: 2px solid var(--eht-marker-color);
    outline-offset: 4px;
}

.eht-viewport.is-dragging,
.eht-viewport.is-animating {
    scroll-snap-type: none !important;
    scroll-behavior: auto;
}

.eht-viewport.is-dragging {
    cursor: grabbing;
    user-select: none;
}

.eht--draggable .eht-viewport {
    cursor: grab;
}

.eht-track {
    display: grid;
}

.eht-item {
    display: grid;
    min-width: 0;
}

.eht-cell {
    min-width: 0;
}

/* Linea: lo pseudo-elemento di ogni asse si unisce a quelli adiacenti formando una linea continua */
.eht-axis {
    position: relative;
    display: flex;
    align-items: center;
    min-width: var(--eht-line-width);
    min-height: var(--eht-line-width);
}

.eht-axis::before {
    content: "";
    position: absolute;
    border: 0 var(--eht-line-style) var(--eht-line-color);
}

/* Marker */
.eht-marker {
    position: relative;
    z-index: 1;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--eht-marker-size);
    height: var(--eht-marker-size);
    border: 0 solid var(--eht-marker-color);
}

/* Freccia: triangolo con la base sulla linea e la punta verso la scheda (direzione da --eht-caret-rot) */
.eht--marker-caret .eht-marker {
    transform: rotate(var(--eht-caret-rot, 0deg));
}

.eht--marker-caret .eht-marker::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--eht-marker-color);
    clip-path: polygon(50% 0, 100% 50%, 0 50%);
}

.eht--marker-dot .eht-marker {
    border-radius: 50%;
    background: var(--eht-marker-color);
}

.eht--marker-icon .eht-marker {
    border-radius: 50%;
    color: var(--eht-marker-color);
    font-size: calc(var(--eht-marker-size) * 0.6);
    line-height: 1;
}

.eht--marker-icon .eht-marker svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
}

/* Scheda */
.eht-card {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 480px;
}

.eht-year,
.eht-title {
    margin: 0;
}

.eht-content > :last-child {
    margin-bottom: 0;
}

.eht-image img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Frecce */
.eht .eht-nav {
    position: absolute;
    top: var(--eht-axis-y, 50%);
    z-index: 2;
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #ccc;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    transform: translateY(-50%);
    transition: color 0.2s, background-color 0.2s, opacity 0.2s;
}

.eht-nav--prev {
    left: 0;
}

.eht-nav--next {
    right: 0;
}

.eht .eht-nav:hover,
.eht .eht-nav:focus {
    /* neutralizza gli stili button:hover del tema; colori e sfondi hover arrivano dai controlli del widget */
    border: 0;
    background-color: transparent;
}

.eht-nav:disabled {
    opacity: 0.3;
    cursor: default;
}

.eht-nav svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
}

.eht-nav svg path[fill="none"] {
    fill: none;
}

/* Animazione in entrata (la classe eht--animate è aggiunta dal JS, quindi senza JS tutto resta visibile) */
.eht--animate .eht-item .eht-card,
.eht--animate .eht-item .eht-cell-year .eht-year {
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.eht--animate .eht-item:not(.is-visible) .eht-card,
.eht--animate .eht-item:not(.is-visible) .eht-cell-year .eht-year {
    opacity: 0;
    transform: translateY(20px);
}

@media (prefers-reduced-motion: reduce) {
    .eht--animate .eht-item .eht-card,
    .eht--animate .eht-item .eht-cell-year .eht-year {
        transition: none;
        opacity: 1;
        transform: none;
    }
}
