/* Calendrier — isolé. Ne pas faire dépendre Album/Livre/Fondu de ces règles. */
body.fx-calendrier-on #book {
    background: radial-gradient(ellipse at 50% 18%, color-mix(in srgb, var(--fx-cal) 55%, #fff) 0%, var(--fx-cal) 72%);
}
body.fx-calendrier-on #navHud { display: none; }
body.cal-day-on #controls {
    opacity: 0 !important;
    pointer-events: none !important;
}

.cal-scene {
    position: absolute;
    inset: 0;
    pointer-events: auto;
    z-index: 6;
}
.cal-sheet {
    position: absolute;
    left: 4%;
    right: 4%;
    top: 6%;
    bottom: 7%;
    background: linear-gradient(180deg, color-mix(in srgb, var(--fx-cal) 40%, #fff) 0%, var(--fx-cal) 100%);
    border: 1px solid rgba(90, 70, 40, .18);
    box-shadow: 0 18px 50px rgba(40, 28, 16, .22), inset 0 1px 0 #fff;
    transform: rotate(-1.7deg);
    transform-origin: 50% 60%;
    padding: 22px 26px 20px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.cal-sheet::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 12%;
    width: 90px;
    height: 22px;
    background: color-mix(in srgb, var(--gold) 42%, transparent);
    transform: rotate(-8deg);
    pointer-events: none;
}
.cal-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gold);
}
.cal-head h2 {
    margin: 0;
    font-family: var(--serif);
    font-size: clamp(22px, 2.4vw, 34px);
    color: var(--ink);
    font-weight: 700;
}
.cal-head .cal-range {
    font-size: 15px;
    color: var(--ink-soft);
    letter-spacing: .04em;
}
.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}
.cal-weekdays span {
    text-align: center;
    font-size: 12px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--sky);
}
.cal-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}
.cal-day {
    position: relative;
    background: rgba(255, 253, 248, .72);
    border: 1px solid rgba(90, 70, 40, .12);
    border-radius: 8px;
    padding: 8px 8px 10px;
    min-height: 0;
    overflow: hidden;
    cursor: default;
    transform: rotate(var(--tilt, 0deg));
}
.cal-day.has-photos {
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(40, 28, 16, .08);
}
.cal-day.has-photos:hover {
    background: #fff;
    outline: 2px solid var(--rouge);
    outline-offset: -1px;
}
.cal-day.empty { opacity: .45; }
.cal-day:nth-child(7n + 1) { --tilt: -1.1deg; }
.cal-day:nth-child(7n + 2) { --tilt: .7deg; }
.cal-day:nth-child(7n + 3) { --tilt: -0.4deg; }
.cal-day:nth-child(7n + 4) { --tilt: 1.2deg; }
.cal-day:nth-child(7n + 5) { --tilt: -0.8deg; }
.cal-day:nth-child(7n + 6) { --tilt: .5deg; }
.cal-day:nth-child(7n) { --tilt: -1.4deg; }
.cal-num {
    font-family: var(--serif);
    font-size: clamp(18px, 2vw, 28px);
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
}
.cal-pile {
    position: relative;
    height: 58%;
    margin: 8px 4px 0;
}
.cal-chip {
    position: absolute;
    left: 18%;
    top: 8%;
    width: 64%;
    height: 78%;
    object-fit: cover;
    background: #ddd;
    border: 3px solid color-mix(in srgb, var(--fx-cal) 35%, #fff);
    box-shadow: 0 4px 10px rgba(0, 0, 0, .2);
    transform: rotate(var(--r, 0deg));
}
.cal-count {
    position: absolute;
    right: 8px;
    bottom: 8px;
    min-width: 28px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--rouge);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}
.cal-spread {
    position: absolute;
    inset: 0;
    background: rgba(18, 14, 10, .88);
    display: none;
    flex-direction: column;
    padding: 16px 18px 18px;
    z-index: 8;
}
.cal-spread.on { display: flex; }
.cal-spread-bar {
    position: relative;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    flex-shrink: 0;
}
.cal-spread-bar h3 {
    margin: 0;
    color: var(--fx-cal);
    font-family: var(--serif);
    font-size: 22px;
}
.cal-fold {
    border: 0;
    background: var(--rouge);
    color: #fff;
    font-family: var(--serif);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: .04em;
    padding: 10px 18px;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
}
.cal-nav {
    position: absolute;
    inset: 0;
    z-index: 13;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s;
}
.cal-spread.show-nav .cal-nav { opacity: 1; }
.cal-nav button {
    pointer-events: none;
    width: 72px;
    height: 72px;
    border: 1px solid var(--fx-cal);
    border-radius: 50%;
    background: color-mix(in srgb, var(--fx-hud) 94%, #fff);
    color: var(--ink);
    font-size: 34px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(42, 38, 34, .18);
}
.cal-spread.show-nav .cal-nav button { pointer-events: auto; }
.cal-nav .cal-pause { font-size: 22px; letter-spacing: 2px; }
.cal-spread-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    grid-auto-rows: minmax(110px, 1fr);
    gap: 8px;
    pointer-events: none;
}
.cal-thumb {
    position: relative;
    overflow: hidden;
    background: var(--fx-stage);
    opacity: .5;
}
.cal-thumb.lit {
    opacity: 1;
    outline: 2px solid var(--fx-mosaic-line);
    outline-offset: -2px;
}
.cal-thumb.air { opacity: 0; }
.cal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.cal-carousel {
    position: absolute;
    inset: 56px 0 0 0;
    z-index: 10;
    pointer-events: none;
}
.cal-carousel img.photo {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0;
    max-width: none;
    max-height: none;
    object-fit: cover;
    opacity: 0;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
    background: transparent;
}
.cal-who {
    position: absolute;
    left: 22px;
    bottom: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(40vw, 340px);
    padding: 7px 14px 7px 7px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--fx-who) 55%, transparent);
    color: var(--fx-who-ink);
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s ease;
    z-index: 11;
}
.cal-who.on { opacity: 1; }
.cal-who.no-av { padding-left: 14px; }
.cal-who .who-av {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, .2);
}
.cal-who .who {
    font-family: var(--serif);
    font-size: 15px;
    font-weight: 600;
}
.cal-who .when {
    margin-top: 2px;
    font-size: 11px;
    letter-spacing: .06em;
    color: color-mix(in srgb, var(--fx-who-ink) 58%, transparent);
}
