.histoire-page-clean {
    position: relative;
    padding-top: 124px;
    overflow: clip;
    background:
        linear-gradient(rgba(246, 245, 244, .1), rgba(246, 245, 244, .9)),
        url("../images/tunisie.jpg") center / cover no-repeat;
}

.histoire-page-clean::before,
.histoire-page-clean::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
    z-index: -1;
}

.histoire-page-clean::before {
    width: 560px;
    height: 560px;
    top: -250px;
    right: -190px;
    background: radial-gradient(circle at center, rgba(233, 201, 211, .24), rgba(233, 201, 211, 0));
}

.histoire-page-clean::after {
    width: 520px;
    height: 520px;
    bottom: -220px;
    left: -170px;
    background: radial-gradient(circle at center, rgba(227, 214, 190, .22), rgba(227, 214, 190, 0));
}

.histoire-postale {
    padding-top: 0;
    padding-bottom: 34px;
}

.histoire-postcard-stage {
    max-width: 1020px;
    margin: 0 auto;
    perspective: 2000px;
}

.histoire-postcard-card {
    position: relative;
    height: clamp(520px, 72vh, 700px);
    border-radius: 22px;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transition: transform .95s cubic-bezier(.2, .72, .22, 1);
    will-change: transform;
}

.histoire-postcard-card.is-flipped {
    transform: rotateY(180deg);
}

.histoire-postcard-face {
    position: absolute;
    inset: 0;
    border-radius: 22px;
    border: 1px solid rgba(23, 20, 20, .12);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* overflow:hidden removed — it flattens preserve-3d in Safari/WebKit */
    clip-path: inset(0 round 22px);
}

.histoire-postcard-front {
    background: #fff;
    box-shadow:
        0 20px 44px rgba(23, 20, 20, .12),
        inset 0 1px 0 rgba(255, 255, 255, .95);
    padding: 14px;
}

.histoire-postcard-photo {
    margin: 0;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.histoire-postcard-photo::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(23, 20, 20, .04) 0%, rgba(23, 20, 20, .38) 100%);
}

.histoire-postcard-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
}

.histoire-postcard-front-overlay {
    position: absolute;
    left: 32px;
    right: 132px;
    bottom: 30px;
    z-index: 1;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .44);
    background: rgba(27, 19, 21, .44);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.histoire-kicker {
    display: inline-block;
    margin-bottom: 7px;
    font-size: .66rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: rgba(255, 246, 250, .9);
}

.histoire-postcard-front-overlay .section-title {
    margin: 0;
    color: #fff;
    font-size: clamp(2rem, 4vw, 3.3rem);
    line-height: .9;
}

.histoire-postcard-front-overlay p {
    margin: 8px 0 0;
    color: rgba(255, 246, 250, .9);
    font-size: .9rem;
    line-height: 1.45;
}

.histoire-postcard-stamp {
    position: absolute;
    top: 26px;
    right: 26px;
    width: 84px;
    height: 84px;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: rotate(4deg);
    z-index: 2;
}

.histoire-postcard-stamp img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px;
}

.histoire-postcard-back {
    transform: rotateY(180deg);
    background:
        linear-gradient(90deg, rgba(23, 20, 20, .11) 65.5%, transparent 65.5%),
        repeating-linear-gradient(180deg,
            rgba(124, 156, 202, .16) 0px,
            rgba(124, 156, 202, .16) 1px,
            transparent 1px,
            transparent 40px),
        linear-gradient(180deg, #fffaf3 0%, #fff 100%);
    box-shadow:
        0 20px 44px rgba(23, 20, 20, .12),
        inset 0 1px 0 rgba(255, 255, 255, .92);
    padding: 18px 20px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 10px;
}

.histoire-postcard-back-head {
    display: flex;
    justify-content: flex-end;
    gap: 14px;
    font-size: .7rem;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: rgba(23, 20, 20, .54);
}

.histoire-postcard-back-layout {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.58fr) minmax(0, .82fr);
    gap: 16px;
}

.histoire-postcard-message {
    min-height: 0;
    height: auto;
    overflow: auto;
    padding-right: 8px;
    display: block;
}

.histoire-postcard-message p {
    margin: 0;
    color: rgba(46, 38, 34, .95);
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.58;
    font-size: clamp(1.18rem, 1.45vw, 1.45rem);
    text-wrap: pretty;
    text-shadow: none;
}

.histoire-postcard-message p+p {
    margin-top: 20px;
}

.histoire-postcard-message .is-intro {
    color: rgba(40, 32, 28, .98);
    font-size: clamp(1.42rem, 1.85vw, 1.9rem);
    line-height: 1.5;
    font-weight: 700;
    transform: none;
}

.histoire-postcard-message .is-intro + p {
    margin-top: 28px;
}

.histoire-postcard-message p:nth-child(2n) {
    transform: none;
}

.histoire-postcard-message p:nth-child(2n + 1):not(.is-intro) {
    transform: none;
}

.histoire-postcard-address {
    border-left: 1px solid rgba(23, 20, 20, .14);
    padding-left: 14px;
    display: grid;
    align-content: start;
    gap: 16px;
}

.histoire-postcard-postmark {
    border: 1px dashed rgba(23, 20, 20, .28);
    border-radius: 999px;
    min-height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    font-size: .62rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(23, 20, 20, .62);
    text-align: center;
}

.histoire-postcard-lines {
    display: grid;
    gap: 14px;
    margin-top: 10px;
}

.histoire-postcard-lines span {
    display: block;
    height: 1px;
    background: rgba(23, 20, 20, .22);
}

.histoire-postcard-signature {
    justify-self: end;
    font-family: "Bebas Neue", sans-serif;
    font-size: clamp(1.45rem, 1.9vw, 1.95rem);
    font-weight: 400;
    letter-spacing: .08em;
    color: rgba(49, 39, 34, .92);
    transform: none;
}

.histoire-postcard-controls {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.histoire-postcard-toggle {
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(23, 20, 20, .16);
    background: rgba(255, 255, 255, .85);
    color: rgba(23, 20, 20, .78);
    font-size: .72rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.histoire-postcard-toggle:hover {
    transform: translateY(-1px);
    border-color: rgba(23, 20, 20, .26);
    box-shadow: 0 8px 18px rgba(23, 20, 20, .12);
}

.histoire-postcard-hint {
    font-size: .78rem;
    color: rgba(23, 20, 20, .56);
}

@media (hover: hover) and (pointer: fine) {
    .histoire-postcard-stage:not([data-user-interacted]):hover .histoire-postcard-card {
        transform: rotateY(180deg);
    }
}

@media (max-width: 980px) {
    .histoire-page-clean {
        padding-top: 110px;
    }

    .histoire-postcard-card {
        height: clamp(500px, 68vh, 640px);
    }

    .histoire-postcard-front-overlay {
        left: 24px;
        right: 102px;
        bottom: 22px;
    }
}

@media (max-width: 760px) {
    .histoire-page-clean {
        padding-top: 96px;
    }

    .histoire-postale {
        padding-bottom: 22px;
    }

    .histoire-postcard-card {
        height: clamp(520px, 72vh, 620px);
        border-radius: 16px;
    }

    .histoire-postcard-face {
        border-radius: 16px;
        clip-path: inset(0 round 16px);
    }

    .histoire-postcard-front {
        padding: 10px;
    }

    .histoire-postcard-front-overlay {
        left: 18px;
        right: 18px;
        bottom: 18px;
        padding: 10px 12px;
        border-radius: 10px;
    }

    .histoire-postcard-front-overlay p {
        font-size: .84rem;
    }

    .histoire-postcard-photo img {
        object-position: center 14%;
    }

    .histoire-postcard-stamp {
        top: 16px;
        right: 16px;
        width: 64px;
        height: 64px;
        padding: 3px;
    }

    .histoire-postcard-back {
        padding: 12px;
        gap: 8px;
    }

    .histoire-postcard-back-layout {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .histoire-postcard-address {
        display: none;
    }

    .histoire-postcard-message p {
        font-size: clamp(1.12rem, 4.8vw, 1.38rem);
        line-height: 1.5;
    }

    .histoire-postcard-message p+p {
        margin-top: 16px;
    }

    .histoire-postcard-message {
        height: auto;
        display: block;
        overflow: auto;
    }

    .histoire-postcard-message .is-intro {
        font-size: clamp(1.28rem, 5.4vw, 1.62rem);
    }

    .histoire-postcard-message .is-intro + p {
        margin-top: 22px;
    }

    .histoire-postcard-signature {
        font-size: clamp(1.5rem, 5vw, 1.8rem);
    }

    .histoire-postcard-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .histoire-postcard-toggle {
        width: 100%;
    }

    .histoire-postcard-hint {
        font-size: .72rem;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {

    .histoire-postcard-card,
    .histoire-postcard-toggle {
        transition: none;
    }

    .histoire-postcard-stage:not([data-user-interacted]):hover .histoire-postcard-card {
        transform: none;
    }
}
