/**
 * Card Collection - fiche detaillee d'une carte
 *
 * La carte est affichee a taille raisonnable (280 px de large au
 * maximum, soit un peu plus grande que la taille reelle a l'ecran)
 * plutot qu'en pleine largeur. Le plein ecran reste accessible a la
 * demande via la visionneuse.
 *
 * @copyright (c) 2024, Verturin
 * @license GNU General Public License, version 2 (GPL-2.0)
 */

.cc-detail {
	--cc-detail-width: 280px;
}

/* =============================================================
 * MISE EN PAGE : visuel a gauche, informations a droite
 * ============================================================= */

.cc-detail-grid {
	display: grid;
	grid-template-columns: var(--cc-detail-width) minmax(0, 1fr);
	gap: 32px;
	align-items: start;
	margin: 0 0 28px;
}

@media (max-width: 720px) {
	.cc-detail-grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 22px;
		justify-items: center;
	}

	.cc-detail-side {
		width: 100%;
	}
}

.cc-detail-visual {
	position: sticky;
	top: 16px;
}

@media (max-width: 720px) {
	.cc-detail-visual {
		position: static;
	}
}

/* =============================================================
 * CARTE AVEC BASCULE RECTO / VERSO
 * ============================================================= */

.cc-flip {
	perspective: 1400px;
	width: var(--cc-detail-width);
	max-width: 100%;
	aspect-ratio: 64 / 89;
	cursor: zoom-in;
}

.cc-flip-inner {
	position: relative;
	width: 100%;
	height: 100%;
	transform-style: preserve-3d;
	transition: transform .55s cubic-bezier(.4, .2, .2, 1);
}

.cc-flip.is-flipped .cc-flip-inner {
	transform: rotateY(180deg);
}

.cc-flip-face {
	position: absolute;
	inset: 0;
	backface-visibility: hidden;
	border-radius: 12px;
	overflow: hidden;
	background: rgba(0, 0, 0, .06);
	box-shadow: 0 2px 6px rgba(0, 0, 0, .10), 0 14px 34px rgba(0, 0, 0, .16);
}

.cc-flip-back {
	transform: rotateY(180deg);
}

.cc-flip-face img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Liseré de rareté */
.cc-flip-face::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	border: 2px solid transparent;
	pointer-events: none;
}

.cc-flip-face[data-rarity="rare"]::after       { border-color: #3b82f6; }
.cc-flip-face[data-rarity="ultra_rare"]::after { border-color: #a855f7; }
.cc-flip-face[data-rarity="legendary"]::after  {
	border-color: #f59e0b;
	box-shadow: inset 0 0 22px rgba(245, 158, 11, .35);
}

/* Boutons sous la carte */
.cc-visual-actions {
	display: flex;
	gap: 8px;
	justify-content: center;
	margin-top: 14px;
}

.cc-mini-btn {
	padding: 6px 14px;
	border: 1px solid rgba(0, 0, 0, .12);
	border-radius: 999px;
	background: rgba(255, 255, 255, .8);
	color: inherit;
	font: inherit;
	font-size: .84em;
	cursor: pointer;
	transition: background .15s ease, border-color .15s ease;
}

.cc-mini-btn:hover {
	background: #3b82f6;
	border-color: #3b82f6;
	color: #fff;
}

.cc-format-note {
	margin-top: 10px;
	font-size: .78em;
	text-align: center;
	color: #6b7280;
}

/* =============================================================
 * COLONNE INFORMATIONS
 * ============================================================= */

.cc-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	margin: 0 0 16px;
}

.cc-chip {
	display: inline-block;
	padding: 3px 11px;
	border-radius: 999px;
	background: rgba(0, 0, 0, .06);
	font-size: .76em;
	font-weight: 600;
}

@media (prefers-color-scheme: dark) {
	.cc-chip { background: rgba(255, 255, 255, .10); }
}

.cc-detail-lead {
	margin: 0 0 8px;
	font-size: 1.15em;
	font-weight: 600;
	line-height: 1.35;
}

.cc-detail-desc {
	margin: 0 0 18px;
	line-height: 1.55;
	color: #4b5563;
}

@media (prefers-color-scheme: dark) {
	.cc-detail-desc { color: #9ca3af; }
}

/* Tableau des caracteristiques */
.cc-facts {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 0;
	margin: 0 0 20px;
	border-top: 1px solid rgba(0, 0, 0, .08);
}

.cc-facts dt,
.cc-facts dd {
	margin: 0;
	padding: 9px 0;
	border-bottom: 1px solid rgba(0, 0, 0, .08);
}

.cc-facts dt {
	padding-right: 22px;
	font-size: .86em;
	font-weight: 600;
	color: #6b7280;
	white-space: nowrap;
}

.cc-facts dd {
	min-width: 0;
	overflow-wrap: anywhere;
}

.cc-facts code {
	padding: 1px 7px;
	border-radius: 4px;
	background: rgba(0, 0, 0, .06);
	font-family: ui-monospace, Menlo, Consolas, monospace;
	font-size: .9em;
}

@media (prefers-color-scheme: dark) {
	.cc-facts     { border-color: rgba(255, 255, 255, .10); }
	.cc-facts dt,
	.cc-facts dd  { border-color: rgba(255, 255, 255, .10); }
	.cc-facts code { background: rgba(255, 255, 255, .10); }
}

.cc-section-title {
	margin: 26px 0 12px;
	font-size: 1.05em;
	font-weight: 700;
}

/* Historique de propriete */
.cc-history {
	margin: 0 0 24px;
	padding: 0;
	list-style: none;
	border-left: 2px solid rgba(0, 0, 0, .1);
}

.cc-history li {
	position: relative;
	padding: 7px 0 7px 18px;
	font-size: .9em;
}

.cc-history li::before {
	content: "";
	position: absolute;
	left: -5px;
	top: 15px;
	width: 8px;
	height: 8px;
	border-radius: 999px;
	background: #3b82f6;
}

.cc-history-date {
	display: inline-block;
	margin-right: 8px;
	font-variant-numeric: tabular-nums;
	color: #6b7280;
}

/* Bouton de suppression */
.cc-danger:hover {
	background: #ef4444 !important;
	border-color: #ef4444 !important;
	color: #fff !important;
}

/* =============================================================
 * VISIONNEUSE PLEIN ECRAN
 * ============================================================= */

.cc-lightbox {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(0, 0, 0, .88);
	cursor: zoom-out;
}

.cc-lightbox[hidden] {
	display: none;
}

.cc-lightbox img {
	max-width: min(92vw, 560px);
	max-height: 92vh;
	border-radius: 10px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.cc-lightbox-close {
	position: absolute;
	top: 16px;
	right: 20px;
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 999px;
	background: rgba(255, 255, 255, .14);
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}

.cc-lightbox-close:hover {
	background: rgba(255, 255, 255, .28);
}

/* =============================================================
 * ACCESSIBILITE
 * ============================================================= */

@media (prefers-reduced-motion: reduce) {
	.cc-flip-inner,
	.cc-mini-btn {
		transition: none;
	}
}

/* =============================================================
 * VISITEUR NON CONNECTE
 * ============================================================= */

.cc-guest {
	margin: 0 0 20px;
	padding: 18px 20px;
	border-radius: 12px;
	border: 1px solid rgba(59, 130, 246, .3);
	background: linear-gradient(135deg, rgba(59, 130, 246, .09), rgba(168, 85, 247, .07));
}

.cc-guest strong {
	display: block;
	margin-bottom: 6px;
	font-size: 1.02em;
}

.cc-guest p {
	margin: 0 0 12px;
	font-size: .9em;
	line-height: 1.5;
	color: #4b5563;
}

@media (prefers-color-scheme: dark) {
	.cc-guest p { color: #9ca3af; }
}

.cc-guest-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 9px;
	margin: 0 !important;
}

/* Carte non interactive pour les visiteurs non connectes */
.cc-flip.is-locked {
	cursor: default;
}

.cc-mini-btn.is-locked {
	opacity: .5;
	cursor: not-allowed;
	pointer-events: none;
	user-select: none;
}
