/* =========================================================================
   Compte à rebours de l'ouverture (assets/js/ouverture.js), commun à la
   Gazette et au mur, aux couleurs du journal : quatre volets de papier
   crème aux chiffres à l'encre noire, qui basculent comme une horloge à
   palettes, et le petit carton « Un peu de patience ». Caractères droits
   seulement (Caslon, Playfair en gras) : pas d'italique.
   ========================================================================= */
.cd {
    --cd-w: 58px;
    --cd-h: 66px;
    --cd-fs: 32px;
    --cd-gap: 11px;
    --cd-ink: #111;
    --cd-hinge: #000;
    /* colonnes égales pour heures, minutes et secondes : les volets restent
       à pas réguliers même quand « Secondes » déborde d'un volet ; les
       jours gardent leur largeur (trois chiffres au-delà de 99 jours) */
    display: grid;
    grid-template-columns: auto repeat(3, 1fr);
    gap: var(--cd-gap);
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
}

@media (max-width: 359px) {
    .cd {
        --cd-w: 50px;
        --cd-h: 58px;
        --cd-fs: 28px;
        --cd-gap: 8px;
    }
}

@media (min-width: 640px) {
    .cd {
        --cd-w: 84px;
        --cd-h: 96px;
        --cd-fs: 48px;
        --cd-gap: 20px;
    }
}

.cd-unit {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
}

/* un losange d'encre entre deux volets, façon Art déco */
.cd-unit+.cd-unit::before {
    content: "";
    position: absolute;
    top: calc(var(--cd-h) / 2);
    left: calc(var(--cd-gap) / -2);
    width: 5px;
    height: 5px;
    background: var(--cd-ink);
    transform: translate(-50%, -50%) rotate(45deg);
}

.cd-card {
    position: relative;
    display: block;
    width: var(--cd-w);
    height: var(--cd-h);
    perspective: 340px;
    border-radius: 4px;
    box-shadow:
        0 0 0 1px #000,
        0 3px 0 0 rgba(0, 0, 0, .16),
        0 6px 12px rgba(0, 0, 0, .12);
    font-family: "Libre Caslon Text", Georgia, serif;
    font-weight: 700;
    font-size: var(--cd-fs);
    font-variant-numeric: lining-nums tabular-nums;
    letter-spacing: .02em;
    color: var(--cd-ink);
}

.cd-card.is-wide {
    width: calc(var(--cd-w) * 1.4);
}

.cd-half {
    position: absolute;
    left: 0;
    right: 0;
    height: 50%;
    overflow: hidden;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.cd-top {
    top: 0;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, #fffdf8 0%, #f3eee4 100%);
}

.cd-bottom {
    bottom: 0;
    border-radius: 0 0 4px 4px;
    background: linear-gradient(180deg, #ebe5d8 0%, #f6f2ea 100%);
}

.cd-half>span {
    position: absolute;
    left: 0;
    right: 0;
    height: var(--cd-h);
    line-height: var(--cd-h);
    text-align: center;
}

.cd-top>span {
    top: 0;
}

.cd-bottom>span {
    bottom: 0;
}

/* Les battants : le haut de l'ancien chiffre bascule vers l'avant, puis le
   bas du nouveau retombe. */
.cd-leaf-top {
    z-index: 2;
    transform-origin: 50% 100%;
}

.cd-leaf-bottom {
    z-index: 2;
    transform-origin: 50% 0;
    transform: rotateX(90deg);
}

.cd-card.is-flipping .cd-leaf-top {
    animation: cd-battant-haut .28s cubic-bezier(.55, .06, .68, .19) forwards;
}

.cd-card.is-flipping .cd-leaf-bottom {
    animation: cd-battant-bas .32s .28s cubic-bezier(.22, .61, .36, 1) forwards;
}

@keyframes cd-battant-haut {
    from {
        transform: rotateX(0deg);
    }

    to {
        transform: rotateX(-90deg);
    }
}

@keyframes cd-battant-bas {
    from {
        transform: rotateX(90deg);
    }

    to {
        transform: rotateX(0deg);
    }
}

/* la fente du milieu, et ses deux charnières */
.cd-card::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    margin-top: -.5px;
    background: #000;
    z-index: 3;
}

.cd-card::after {
    content: "";
    position: absolute;
    left: -3px;
    right: -3px;
    top: 50%;
    height: 7px;
    margin-top: -3.5px;
    background: linear-gradient(90deg, var(--cd-hinge) 0 3px, transparent 3px calc(100% - 3px), var(--cd-hinge) calc(100% - 3px));
    z-index: 4;
}

.cd-label {
    padding-left: .22em;
    white-space: nowrap;
    font-family: "Libre Caslon Text", Georgia, serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: #000;
}

@media (max-width: 639px) {
    .cd-label {
        letter-spacing: .12em;
    }
}

@media (max-width: 359px) {
    .cd-label {
        font-size: 8px;
        letter-spacing: .08em;
    }
}

@media (min-width: 640px) {
    .cd-label {
        font-size: 11px;
    }
}

.cd-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---- Le panneau du mur (Chambre noire) : une coupure de la Gazette,
        papier crème et double filet noir ---- */
.cr-compte-panneau {
    display: none;
    position: relative;
    margin: 7px;
    padding: 22px 12px 20px;
    text-align: center;
    color: #000;
    background: #fbf9f8;
    border: 3px double #000;
    box-shadow: 0 0 0 7px #fbf9f8, 0 18px 36px rgba(0, 0, 0, .55);
}

html.cr-ferme .cr-compte-panneau {
    display: block;
}

.cr-compte-titre {
    margin: 0;
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 700;
    font-size: 23px;
    line-height: 1.2;
    color: #000;
}

.cr-compte-sous {
    margin: 6px 0 20px;
    font-family: "Libre Caslon Text", Georgia, serif;
    font-size: 15px;
    color: rgba(0, 0, 0, .72);
}

.cr-compte-date {
    margin: 18px 0 0;
    font-family: "Libre Caslon Text", Georgia, serif;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: #775a19;
}

@media (min-width: 640px) {
    .cr-compte-panneau {
        padding: 34px 24px 30px;
    }

    .cr-compte-titre {
        font-size: 30px;
    }

    .cr-compte-sous {
        font-size: 17px;
        margin-bottom: 26px;
    }

    .cr-compte-date {
        font-size: 12px;
        margin-top: 22px;
    }
}

/* ---- Mode essai : un bandeau discret, pour celui qui a le lien ---- */
.cr-essai-bandeau {
    display: none;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 2px 10px;
    padding: 9px 14px;
    border: 1px dashed rgba(233, 193, 118, .55);
    text-align: center;
    font-family: "Libre Caslon Text", Georgia, serif;
    font-size: 13.5px;
    line-height: 1.4;
    color: rgba(244, 239, 228, .78);
}

html.cr-essai .cr-essai-bandeau {
    display: flex;
}

.cr-essai-bandeau strong {
    font-family: "Libre Caslon Text", Georgia, serif;
    font-style: normal;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: #e9c176;
}

.cr-essai-bandeau button {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: #e9c176;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

/* ---- « Un peu de patience » : au-dessus de la barre du bas ---- */
.cr-patience {
    position: fixed;
    left: 50%;
    bottom: calc(104px + env(safe-area-inset-bottom));
    z-index: 70;
    width: max-content;
    max-width: min(88vw, 420px);
    padding: 12px 18px;
    background: #fbf9f8;
    color: #000;
    border: 3px double #000;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .35);
    font-family: "Libre Caslon Text", Georgia, serif;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    opacity: 0;
    transform: translate(-50%, 10px);
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
}

.cr-patience.is-on {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (min-width: 768px) {
    .cr-patience {
        bottom: 140px;
    }
}

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

    .cd-card.is-flipping .cd-leaf-top,
    .cd-card.is-flipping .cd-leaf-bottom {
        animation: none;
    }

    .cr-patience {
        transition: none;
    }
}
