/* CosmaPress Redazione: galleria, condivisione, video. I colori si adattano al tema tramite variabili. */
.cpr-deck {
	--cpr-ink: var(--cp-ink, #141414);
	--cpr-muted: var(--cp-muted, #5d5d5d);
	--cpr-card: #141414;
	--cpr-radius: 16px;
	--cpr-ratio: 1.5;
	position: relative;
	margin: 0 0 2rem;
}
.cpr-deck__list { list-style: none; margin: 0; padding: 0; }
.cpr-deck__figure { margin: 0; }
.cpr-deck__img { display: block; width: 100%; height: auto; }

/* Senza JavaScript: le foto una sotto l'altra, con didascalie. */
.cpr-deck:not(.is-ready) .cpr-deck__card { margin: 0 0 1.5rem; }
.cpr-deck:not(.is-ready) .cpr-deck__figcaption { font-size: .875rem; color: var(--cpr-muted); padding-top: .5rem; }
.cpr-deck:not(.is-ready) .cpr-deck__credit { display: block; }

/* Mazzo di carte (D04) con cornice adattiva (D05). */
.cpr-deck.is-ready .cpr-deck__stage {
	position: relative;
	width: 100%;
	aspect-ratio: var(--cpr-ratio);
	max-height: min(70vh, 720px);
	margin: 18px 0 0;
	touch-action: pan-y pinch-zoom;
	user-select: none;
	-webkit-user-select: none;
	outline: none;
}
.cpr-deck.is-ready .cpr-deck__stage:focus-visible { box-shadow: 0 0 0 3px var(--cp-accent, #b3001b); border-radius: var(--cpr-radius); }
.cpr-deck.is-ready .cpr-deck__list { position: absolute; inset: 0; }
.cpr-deck.is-ready .cpr-deck__card {
	position: absolute;
	inset: 0;
	border-radius: var(--cpr-radius);
	background: var(--cpr-card);
	overflow: hidden;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .12);
	transition: transform .42s cubic-bezier(.2, .8, .2, 1), opacity .32s ease, filter .32s ease;
	will-change: transform;
	cursor: grab;
}
.cpr-deck.is-ready .cpr-deck__card.is-dragging { transition: none; cursor: grabbing; }
.cpr-deck.is-ready .cpr-deck__figure, .cpr-deck.is-ready .cpr-deck__figure picture { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.cpr-deck.is-ready .cpr-deck__img { width: 100%; height: 100%; object-fit: contain; pointer-events: auto; -webkit-user-drag: none; }
.cpr-deck.is-ready .cpr-deck__figcaption { display: none; }

.cpr-deck__card[data-pos="front"] { z-index: 4; transform: none; opacity: 1; }
.cpr-deck__card[data-pos="back1"] { z-index: 3; transform: translateY(-10px) scale(.955) rotate(1.4deg); filter: brightness(.72); }
.cpr-deck__card[data-pos="back2"] { z-index: 2; transform: translateY(-19px) scale(.915) rotate(-1.6deg); filter: brightness(.55); }
.cpr-deck__card[data-pos="gone"] { z-index: 5; transform: translateX(-118%) rotate(-9deg); opacity: 0; pointer-events: none; }
.cpr-deck__card[data-pos="hidden"] { display: none; }

/* Quattro comandi rotondi e contatore (D06). */
.cpr-deck__controls { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 18px 0 8px; }
.cpr-btn {
	display: inline-flex; align-items: center; justify-content: center;
	width: 48px; height: 48px; padding: 0;
	border-radius: 50%;
	border: 1.5px solid var(--cpr-ink);
	background: transparent; color: var(--cpr-ink);
	cursor: pointer;
	transition: background .15s, color .15s, transform .1s;
}
.cpr-btn:hover { background: var(--cpr-ink); color: #fff; }
.cpr-btn:active { transform: scale(.94); }
.cpr-btn:focus-visible { outline: 3px solid var(--cp-accent, #b3001b); outline-offset: 2px; }
.cpr-btn--nav { width: 56px; height: 56px; background: var(--cpr-ink); color: #fff; border-color: var(--cpr-ink); }
.cpr-btn--nav:hover { background: var(--cp-accent, #b3001b); border-color: var(--cp-accent, #b3001b); }
.cpr-btn:disabled { opacity: .3; cursor: default; background: transparent; color: var(--cpr-ink); }
.cpr-btn--nav:disabled { background: var(--cpr-ink); color: #fff; }
.cpr-deck__counter { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; font-size: .95rem; color: var(--cpr-ink); }
.cpr-deck__sep, .cpr-deck__total { color: var(--cpr-muted); font-weight: 400; }
.cpr-deck__caption { min-height: 1.5em; margin: 6px auto 0; max-width: 46rem; text-align: center; font-size: .925rem; line-height: 1.5; color: var(--cpr-ink); }
.cpr-deck__caption .cpr-deck__credit { display: block; color: var(--cpr-muted); font-size: .8rem; margin-top: 2px; letter-spacing: .01em; }
.cpr-deck__permalink { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.cpr-deck:not(.is-ready) .cpr-deck__permalink { position: static; width: auto; height: auto; clip: auto; font-size: .8rem; }

@media (max-width: 600px) {
	.cpr-deck.is-ready .cpr-deck__stage { max-height: 70vh; }
	.cpr-deck { --cpr-radius: 12px; }
	.cpr-deck__controls { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
	.cpr-deck.is-ready .cpr-deck__card { transition: opacity .01s; }
	.cpr-deck__card[data-pos="gone"] { transform: none; }
}

/* Ingrandimento */
.cpr-zoom { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #0b0b0b; color: #fff; overflow: hidden; }
.cpr-zoom::backdrop { background: #0b0b0b; }
.cpr-zoom__bar { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; z-index: 2; background: linear-gradient(#0b0b0bcc, transparent); }
.cpr-zoom__count { font-variant-numeric: tabular-nums; font-weight: 600; }
.cpr-zoom__close, .cpr-zoom__nav { width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.cpr-zoom__close:hover, .cpr-zoom__nav:hover { background: rgba(255,255,255,.28); }
.cpr-zoom__nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; }
.cpr-zoom__nav--prev { left: 12px; }
.cpr-zoom__nav--next { right: 12px; }
.cpr-zoom__nav:disabled { opacity: .25; cursor: default; }
.cpr-zoom__stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.cpr-zoom__stage img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .25s ease; cursor: zoom-in; touch-action: pinch-zoom; user-select: none; -webkit-user-drag: none; }
.cpr-zoom.is-zoomed .cpr-zoom__stage img { cursor: grab; transition: none; touch-action: none; }
.cpr-zoom__hint { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; font-size: .8rem; opacity: .6; margin: 0; pointer-events: none; }
@media (max-width: 600px) { .cpr-zoom__nav { top: auto; bottom: 44px; transform: none; } }

/* Condivisione */
.cpr-share { width: min(440px, calc(100vw - 24px)); padding: 0; border: 0; border-radius: 16px; background: #fff; color: #141414; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.cpr-share::backdrop { background: rgba(10,10,10,.55); }
.cpr-share__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.cpr-share__title { font-size: 1.05rem; margin: 0; font-family: inherit; }
.cpr-share__close { width: 40px; height: 40px; border-radius: 50%; border: 0; background: #f1efeb; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: inherit; }
.cpr-share__preview { display: flex; gap: 12px; align-items: center; padding: 6px 16px 12px; }
.cpr-share__preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: #222; flex: none; }
.cpr-share__meta { font-size: .85rem; color: #5d5d5d; line-height: 1.35; }
.cpr-share__list { list-style: none; margin: 0; padding: 4px 12px 8px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cpr-share__list button { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border: 0; border-radius: 12px; background: transparent; color: inherit; font: inherit; font-size: .78rem; cursor: pointer; }
.cpr-share__list button svg { width: 44px; height: 44px; padding: 11px; border-radius: 50%; background: #f1efeb; box-sizing: border-box; }
.cpr-share__list button:hover svg, .cpr-share__list button:focus-visible svg { background: #141414; color: #fff; }
.cpr-share__msg { margin: 0; padding: 0 16px; font-size: .85rem; color: #0b6b2e; min-height: 0; }
.cpr-share__msg:not(:empty) { padding: 4px 16px 8px; }
.cpr-share__save { margin: 0; padding: 8px 16px 16px; border-top: 1px solid #ece9e4; }
.cpr-share__save a { display: inline-flex; align-items: center; gap: 8px; color: inherit; font-size: .9rem; text-decoration: none; }
.cpr-share__save svg { width: 20px; height: 20px; }
@media (max-width: 600px) {
	.cpr-share { width: 100vw; max-width: none; margin: auto 0 0; border-radius: 18px 18px 0 0; }
}

/* Video al clic e contenuti esterni */
.cpr-video { margin: 0 0 1.75rem; }
.cpr-video__frame { position: relative; aspect-ratio: 16 / 9; background: #111; border-radius: 12px; overflow: hidden; overflow: clip; }
.cpr-video__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cpr-video__thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cpr-video__play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 76px; height: 76px; border-radius: 50%; border: 0; background: rgba(15,15,15,.82); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s, transform .15s; }
.cpr-video__play svg { width: 34px; height: 34px; margin-left: 4px; }
.cpr-video__play:hover, .cpr-video__play:focus-visible { background: var(--cp-accent, #b3001b); transform: translate(-50%, -50%) scale(1.05); }
.cpr-video.is-asking .cpr-video__play { display: none; }
.cpr-video__ask { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 16px; text-align: center; background: rgba(12,12,12,.86); color: #fff; font-size: .95rem; }
.cpr-video__ask[hidden] { display: none; }
/* Avviso aperto: il riquadro resta almeno 16:9 e cresce con il testo (schermi stretti, testo ingrandito),
   anche nei browser senza overflow: clip. Il distanziatore invisibile tiene la proporzione. */
.cpr-video.is-asking .cpr-video__frame { display: grid; aspect-ratio: auto; }
.cpr-video.is-asking .cpr-video__frame::before { content: ""; grid-area: 1 / 1; padding-top: 56.25%; }
.cpr-video.is-asking .cpr-video__ask { grid-area: 1 / 1; position: relative; inset: auto; }
.cpr-video__ask p { margin: 0 0 6px; max-width: 30rem; }
.cpr-video__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.cpr-video__accept { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 0; background: #fff; color: #141414; font: inherit; font-weight: 600; cursor: pointer; }
.cpr-video__actions a { color: #fff; }
.cpr-video__note { font-size: .8rem; color: var(--cp-muted, #5d5d5d); margin-top: 6px; }
.cpr-video.is-playing .cpr-video__note { display: none; }

/* Dicitura IA e sezione correlata, quando il tema non le stila */
.cpr-ia { font-size: .85rem; color: var(--cp-muted, #5d5d5d); margin: .25rem 0 1rem; }
.cpr-related { margin: 2.5rem 0; }
.cpr-related__list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.cpr-related__item a { display: grid; gap: 6px; color: inherit; text-decoration: none; }
.cpr-related__item img { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px; }
.cpr-related__format { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--cp-accent, #b3001b); font-weight: 700; }
.cpr-related__headline { font-weight: 600; line-height: 1.3; }
