/* Portfolio : le bureau dessiné et ses livres. Chargé uniquement sur la page Portfolio. */

.am-portfolio-page {
	margin: 0;
	min-height: 100vh;
	background: #fff8e8; /* même crème que le fond du dessin du bureau */
	color: #f5efe6;
	font-family: Menlo, "AM Mono", "DejaVu Sans Mono", monospace;
	overflow-x: hidden;
}
html.am-lecture { overflow: hidden; }

/* ---------- Bandeau du haut, discret, posé sur le bureau ---------- */
.am-pf-entete {
	position: fixed;
	z-index: 5;
	top: 0;
	left: 0;
	right: 0;
	display: flex;
	align-items: baseline;
	gap: 18px;
	flex-wrap: wrap;
	padding: 14px 18px;
	pointer-events: none;
}
.am-pf-entete > * { pointer-events: auto; }
.am-pf-retour,
.am-pf-aide {
	font-size: 12px;
	background: rgba(43, 38, 35, 0.75);
	color: #f5efe6;
	padding: 6px 10px;
	text-decoration: none;
	margin: 0;
}
.am-pf-retour:hover,
.am-pf-retour:focus-visible { background: #c55748; }
.am-pf-titre { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); }
.am-pf-aide { margin-left: auto; }

/* ---------- Le bureau : toujours entier dans l'écran ---------- */
.am-bureau-zone {
	min-height: 100vh;
	min-height: 100svh;
	display: grid;
	place-items: center;
}

.am-bureau {
	position: relative;
	aspect-ratio: var(--ratio-ordi);
	width: min(100vw, 100svh * var(--ratio-ordi-n));
	overflow: hidden;
}
.am-bureau--provisoire {
	background:
		repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.05) 0 2px, transparent 2px 90px),
		#b98a5e;
}
.am-bureau__dessin img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: fill;
	display: block;
}

/* ---------- Un livre posé ---------- */
.am-livre {
	position: absolute;
	left: var(--ox);
	top: var(--oy);
	width: var(--ow);
	transform: rotate(var(--or));
	transform-origin: center;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	transition: transform 0.25s ease, filter 0.25s ease;
	filter: drop-shadow(2px 4px 4px rgba(0, 0, 0, 0.35));
}
.am-livre img { width: 100%; height: auto; display: block; }
.am-livre:hover,
.am-livre:focus-visible {
	transform: rotate(var(--or)) translateY(-2%) scale(1.04);
	filter: drop-shadow(4px 10px 10px rgba(0, 0, 0, 0.45));
	outline: none;
}
.am-livre:focus-visible { outline: 3px solid #c55748; outline-offset: 4px; }

.am-livre__provisoire {
	display: flex;
	align-items: flex-end;
	aspect-ratio: 0.72;
	padding: 10%;
	background: #c55748;
	color: #fff;
	font-family: "AM Playfair", Georgia, serif;
	font-weight: 900;
	font-size: clamp(10px, 1.3vw, 20px);
	text-align: left;
	box-shadow: inset 6px 0 0 rgba(0, 0, 0, 0.18);
}

/* ---------- Livre dessiné dans le bureau : zone cliquable invisible ---------- */
.am-livre--zone {
	height: var(--oh);
	filter: none;
	border-radius: 6px;
	transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.am-livre--zone:hover,
.am-livre--zone:focus-visible {
	transform: rotate(var(--or));
	filter: none;
	background: rgba(255, 248, 225, 0.22);
	box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 0 24px 6px rgba(255, 240, 200, 0.55);
}
a.am-livre { display: block; text-decoration: none; }
/* Toi seule (connectée) vois le contour des zones, pour vérifier leur place. */
html.am-voir-zones .am-livre--zone { outline: 2px dashed rgba(197, 87, 72, 0.9); outline-offset: 0; background: rgba(197, 87, 72, 0.12); }

/* Petit titre qui apparaît au survol. */
.am-livre__etiquette {
	position: absolute;
	left: 50%;
	top: 100%;
	transform: translate(-50%, 6px) rotate(calc(var(--or) * -1));
	white-space: nowrap;
	font-size: 12px;
	background: #fff;
	color: #111;
	padding: 4px 8px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}
.am-livre:hover .am-livre__etiquette,
.am-livre:focus-visible .am-livre__etiquette { opacity: 1; }

.am-pf-vide {
	position: absolute;
	inset: 40% 10% auto;
	background: rgba(255, 255, 255, 0.92);
	color: #111;
	padding: 18px;
	font-size: 13px;
}

/* ---------- Téléphone (écran plus haut que large) : bureau et places dédiés ---------- */
@media (max-aspect-ratio: 4/5) {
	.am-bureau {
		aspect-ratio: var(--ratio-phone);
		width: min(100vw, 100svh * var(--ratio-phone-n));
	}
	.am-livre {
		left: var(--px);
		top: var(--py);
		width: var(--pw);
		transform: rotate(var(--pr));
	}
	.am-livre--zone { height: var(--ph); }
	.am-livre--zone:hover,
	.am-livre--zone:focus-visible { transform: rotate(var(--pr)); }
	.am-livre:hover,
	.am-livre:focus-visible { transform: rotate(var(--pr)) scale(1.04); }
	.am-livre__etiquette { opacity: 1; transform: translate(-50%, 4px) rotate(calc(var(--pr) * -1)); font-size: 10px; }
	.am-pf-aide { display: none; }
}

/* ---------- Le livre ouvert ---------- */
.am-lecteur {
	width: 100vw;
	height: 100vh;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba(24, 20, 18, 0.94);
	color: #f5efe6;
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}
.am-lecteur[open] { display: flex; }
.am-lecteur::backdrop { background: rgba(0, 0, 0, 0.6); }

.am-lecteur__haut {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 18px;
}
.am-lecteur__titre {
	margin: 0;
	font-family: "AM Playfair", Georgia, serif;
	font-weight: 900;
	font-size: 20px;
}
.am-lecteur button {
	font: inherit;
	background: transparent;
	color: inherit;
	border: 1px solid rgba(245, 239, 230, 0.6);
	cursor: pointer;
	min-width: 44px;
	min-height: 44px;
	font-size: 18px;
}
.am-lecteur button:hover,
.am-lecteur button:focus-visible { background: #c55748; border-color: #c55748; outline: none; }

.am-lecteur__livre { display: grid; place-items: center; }
.am-lecteur__flip .stf__item img,
.am-lecteur__flip img { user-select: none; }

.am-lecteur__bas {
	display: flex;
	align-items: center;
	gap: 18px;
	margin-top: 16px;
	font-size: 12px;
}
.am-lecteur__vide { font-size: 13px; }

/* ---------- Toutes les pages (miniatures) ---------- */
.am-lecteur .am-lecteur__tout { font-size: 12px; padding: 0 14px; }
.am-lecteur__sommaire {
	position: absolute;
	inset: 70px 0 90px;
	z-index: 3;
	overflow-y: auto;
	padding: 10px 24px 24px;
	background: rgba(24, 20, 18, 0.96);
}
.am-lecteur__sommaire[hidden] { display: none; }
.am-lecteur__sommaire-titre { margin: 0 0 14px; font-size: 13px; text-align: center; }
.am-lecteur__vignettes {
	list-style: none;
	margin: 0 auto;
	padding: 0;
	max-width: 1100px;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
	gap: 14px;
}
.am-lecteur .am-lecteur__vignettes button {
	display: block;
	width: 100%;
	padding: 0;
	border: 2px solid transparent;
	min-height: 0;
	background: none;
}
.am-lecteur .am-lecteur__vignettes button:hover,
.am-lecteur .am-lecteur__vignettes button:focus-visible { border-color: #c55748; background: none; }
.am-lecteur .am-lecteur__vignettes button.est-actuelle { border-color: #f5efe6; }
.am-lecteur__vignettes img { display: block; width: 100%; aspect-ratio: 0.72; object-fit: cover; background: #3a332f; }
.am-lecteur__vignettes span { display: block; padding: 4px 0; font-size: 11px; text-align: center; }

/* Bouton « Retour au bureau » : bien visible. */
.am-lecteur .am-lecteur__fermer {
	font-size: 13px;
	padding: 0 16px;
	background: rgba(43, 38, 35, 0.85);
}

/* ---------- Livre ouvert sur le bureau vu du dessus ---------- */
.am-lecteur--bureau { background: #2b2623; }
.am-lecteur__scene {
	position: relative;
	background: center / 100% 100% no-repeat;
	animation: am-plongee 0.6s ease-out both;
}
.am-lecteur--bureau .am-lecteur__flip { position: absolute; }
.am-lecteur--bureau .am-lecteur__haut,
.am-lecteur--bureau .am-lecteur__bas { z-index: 2; }
.am-lecteur--bureau .am-lecteur__titre {
	background: rgba(43, 38, 35, 0.75);
	padding: 4px 10px;
	font-size: 16px;
}
.am-lecteur--bureau .am-lecteur__bas {
	position: absolute;
	bottom: 14px;
	left: 50%;
	transform: translateX(-50%);
	margin: 0;
	padding: 6px 10px;
	background: rgba(43, 38, 35, 0.75);
}

/* On « plonge » vers le bureau : léger zoom en arrivant. */
@keyframes am-plongee {
	from { opacity: 0; transform: scale(0.82); }
	to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
	.am-livre, .am-livre__etiquette { transition: none; }
	.am-lecteur__scene { animation: none; }
}

/* Titre du livre ouvert : caché à l'écran, gardé pour les lecteurs d'écran. */
.am-lecteur .am-lecteur__titre {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
	padding: 0;
}
.am-lecteur__haut { justify-content: flex-end; }

/* Pages du livre (mode HTML) : image nette qui remplit la page. */
.am-feuille { background: #fff; overflow: hidden; padding: 0; }
.am-feuille img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; user-select: none; }

/* ---------- Surprise : une seule image (ex. le chien caché sous le bureau) ---------- */
.am-livre--secret,
.am-livre--secret:hover,
.am-livre--secret:focus-visible { background: none; box-shadow: none; }
.am-livre--secret .am-livre__etiquette { display: none; }

.am-lecteur--image { background: rgba(24, 20, 18, 0.92); }
.am-lecteur__image {
	display: block;
	max-width: 92vw;
	max-height: 86vh;
	width: auto;
	height: auto;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
	animation: am-plongee 0.5s ease-out both;
}

/* ---------- La nuit ---------- */
.am-nuit .am-portfolio-page,
html.am-nuit body.am-portfolio-page { background: #14171f; }
.am-nuit .am-livre--zone:hover,
.am-nuit .am-livre--zone:focus-visible {
	background: rgba(255, 220, 140, 0.16);
	box-shadow: 0 0 0 2px rgba(255, 230, 170, 0.8), 0 0 26px 8px rgba(255, 210, 120, 0.45);
}

/* Un élément marqué « caché » le reste, même si son style dit le contraire. */
.am-lecteur [hidden] { display: none !important; }

/* ---------- Curseur pinceau (bureau et livres) ---------- */
.am-portfolio-page,
.am-portfolio-page .am-lecteur { cursor: url("../img/pinceau.svg") 2 30, auto; }
/* Sur ce qui se clique, la pointe du pinceau est trempée dans la peinture rouge. */
.am-portfolio-page a,
.am-portfolio-page button,
.am-portfolio-page .am-livre,
.am-portfolio-page .stf__parent { cursor: url("../img/pinceau-peint.svg") 2 30, pointer; }

/* ---------- La lampe (interrupteur jour / nuit) ---------- */
.am-bureau__dessin img { transition: filter 0.6s ease; }
html.am-nuit--filtre .am-bureau__dessin img { filter: brightness(0.42) saturate(0.85) hue-rotate(-10deg); }
.am-lampe:hover,
.am-lampe:focus-visible {
	background: radial-gradient(closest-side, rgba(255, 220, 130, 0.45), rgba(255, 220, 130, 0) 75%);
	box-shadow: none;
}
.am-nuit .am-lampe:hover,
.am-nuit .am-lampe:focus-visible {
	background: radial-gradient(closest-side, rgba(255, 220, 130, 0.45), rgba(255, 220, 130, 0) 75%);
	box-shadow: none;
}
.am-lampe:focus-visible { outline: 2px solid rgba(255, 230, 170, 0.9); }

/* Bouton « Voir les zones » : visible seulement par toi, quand tu es connectée. */
.am-pf-zones {
	font: inherit;
	font-size: 12px;
	padding: 6px 10px;
	border: 0;
	background: rgba(43, 38, 35, 0.75);
	color: #f5efe6;
	cursor: pointer;
}
.am-pf-zones[aria-pressed="true"] { background: #c55748; }

/* ---------- Téléphone tenu à la verticale, sans dessin dédié : « tourne ton téléphone » ---------- */
.am-tourner { display: none; }
@media (max-aspect-ratio: 4/5) {
	.am-pf-tourner .am-tourner {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 18px;
		min-height: 100vh;
		min-height: 100svh;
		padding: 24px;
		text-align: center;
		color: #2b2623;
	}
	.am-pf-tourner .am-tourner p {
		margin: 0;
		max-width: 260px;
		font-family: "AM Playfair", Georgia, serif;
		font-weight: 900;
		font-size: 22px;
		line-height: 1.25;
	}
	.am-pf-tourner .am-tourner a { color: #c55748; font-size: 13px; }
	.am-tourner__icone { color: #c55748; animation: am-tourne 2.4s ease-in-out infinite; }
	.am-pf-tourner .am-bureau-zone,
	.am-pf-tourner .am-pf-entete { display: none; }
}
@keyframes am-tourne {
	0%, 25% { transform: rotate(0deg); }
	50%, 80% { transform: rotate(-90deg); }
	100% { transform: rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) {
	.am-tourner__icone { animation: none; transform: rotate(-90deg); }
}
/* Téléphone tenu en largeur : on garde tout l'écran pour le dessin. */
@media (max-height: 500px) {
	.am-pf-aide { display: none; }
}
