.story-card {
    width: 100%;
    max-width: 1000px;
    margin: 30px auto;
    padding: 30px 40px;

    border: 1px solid #b89b6d;
    border-radius: 10px;

    background-color: rgba(255,255,255,0.35);

    text-align: left;
    box-sizing: border-box;
}

.story-card p {
    font-size: 1.2rem;
    line-height: 1.7;
    margin: 0 0 20px 0;
}

.story-card p:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .story-card {
        padding: 18px;
        margin: 20px auto;
    }

    .story-card p {
        font-size: 1rem;
    }
}

/* ===== LINEA DEL TEMPO ===== */

.timeline {
    position: relative;
    max-width: 1000px;
    margin: 30px auto 40px auto;
    padding: 0;
    list-style: none;
}

.timeline::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    background-color: #b89b6d;
    transform: translateX(-50%);
}

.timeline-item {
    position: relative;
    width: 50%;
    padding: 0 40px 30px 0;
    box-sizing: border-box;
}

.timeline-item:nth-child(even) {
    margin-left: 50%;
    padding: 0 0 30px 40px;
}

.timeline-item::before {
    content: "";
    position: absolute;
    top: 22px;
    right: -10px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #5b3920;
    border: 3px solid #f6efe0;
}

.timeline-item:nth-child(even)::before {
    right: auto;
    left: -10px;
}

.timeline-content {
    padding: 16px 20px;
    text-align: left;

    border: 1px solid #b89b6d;
    border-radius: 10px;
    background-color: rgba(255,255,255,0.35);
}

.timeline-date {
    display: block;
    color: #5b3920;
    font-size: 1.4rem;
    font-weight: bold;
}

.timeline-content h3 {
    margin: 4px 0 8px 0;
}

.timeline-content p {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.5;
}

@media (max-width: 768px) {

    .timeline::before {
        left: 12px;
        transform: none;
    }

    .timeline-item,
    .timeline-item:nth-child(even) {
        width: 100%;
        margin-left: 0;
        padding: 0 0 24px 40px;
    }

    .timeline-item::before,
    .timeline-item:nth-child(even)::before {
        left: 3px;
        right: auto;
    }
}

/* ===== PIETRO PALEOCAPA ===== */

.story-card.has-portrait {
    display: flow-root;
}

.story-portrait {
    float: left;
    width: 300px;
    max-width: 100%;
    height: auto;
    margin: 4px 32px 16px 0;

    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.story-portrait:hover {
    transform: scale(1.03);
    box-shadow: 0 10px 20px rgba(0,0,0,0.25);
}

@media (max-width: 768px) {
    .story-portrait {
        float: none;
        display: block;
        width: 100%;
        max-width: 320px;
        margin: 0 auto 20px auto;
    }
}

.story-meta {
    margin: 0 0 24px 0;
    font-style: italic;
    color: #5b3920;
}

/* ===== APPROFONDIMENTI ===== */

.story-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 480px));
    justify-content: center;
    gap: 24px;

    max-width: 1000px;
    margin: 30px auto 40px auto;
}

.story-link-card {
    display: flex;
    gap: 20px;
    align-items: center;

    padding: 20px;
    text-align: left;
    text-decoration: none;
    color: inherit;

    border: 1px solid #b89b6d;
    border-radius: 10px;
    background-color: rgba(255,255,255,0.35);

    transition: all 0.3s ease;
}

.story-link-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.story-link-card img {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
}

.story-link-card h3 {
    margin: 0 0 6px 0;
}

.story-link-card p {
    margin: 0;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .story-links {
        grid-template-columns: 1fr;
    }
}


/* ===== IMMAGINI NELLA STORIA ===== */

/* paragrafo con immagine a fianco; su telefono l'immagine va sotto */
.story-with-figure {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    margin: 0 0 20px 0;
}

.story-with-figure p {
    flex: 1;
}

.story-figure {
    flex-shrink: 0;
    width: 240px;
    margin: 4px 0 0 0;
}

.story-figure .story-portrait {
    float: none;
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
}

.story-figure figcaption {
    margin-top: 8px;
    font-size: 0.95rem;
    font-style: italic;
    text-align: center;
    color: #5b3920;
}

.presidents-figure {
    width: 100%;
    max-width: 480px;
    margin: 0 auto 30px auto;
}

.presidents-list {
    max-width: 480px;
    margin: 0 auto;
    padding: 0;
    list-style: none;

    font-size: 1.2rem;
    line-height: 1.8;
}

.presidents-years {
    display: inline-block;
    min-width: 140px;
    font-weight: bold;
    color: #5b3920;
}

@media (max-width: 768px) {
    .story-with-figure {
        flex-direction: column;
        gap: 0;
    }

    .story-figure {
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
    }

    .story-figure .story-portrait {
        max-width: none;
        margin: 0;
    }

    .presidents-list {
        font-size: 1rem;
    }

    .presidents-years {
        min-width: 115px;
    }
}

/* Schermi molto stretti (es. schermo esterno Galaxy Fold, ~280 px):
   immagine sopra e testo sotto, altrimenti la card esce dallo schermo. */
@media (max-width: 340px) {
    .story-link-card {
        flex-direction: column;
        text-align: center;
    }
}
