/* Convishot — page invité. Couleurs de la charte : crème #F6EFE3, encre #1F2A37, rouge flash #E4572E
 * (#B8401C pour le petit texte, contraste suffisant), jaune flash #F5C451.
 * Variables CSS = point d'entrée du futur moteur de thèmes (lot 3).
 * Pas de `gap` sur flex, `aspect-ratio` ni `dvh` sans repli : cible iOS 12.
 */
:root {
	--idf-bg: #f6efe3;
	--idf-fg: #1f2a37;
	--idf-muted: #55606e;
	--idf-accent: #e4572e; /* rouge flash (charte Convishot) */
	--idf-surface: #ffffff;
	--idf-error: #a31d1d;
	--idf-radius: 14px;
	--idf-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.idf--night {
	--idf-bg: #0e0d0c;
	--idf-fg: #efeae0;
	--idf-muted: #a9a399;
	--idf-accent: #f5c451; /* jaune flash */
	--idf-surface: #1c1a18;
	--idf-error: #ff8a80;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body.idf {
	min-height: 100vh;
	background: var(--idf-bg);
	color: var(--idf-fg);
	font-family: var(--idf-font);
	font-size: 17px;
	line-height: 1.45;
	-webkit-text-size-adjust: 100%;
	-webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

/* ---------- En-tête ---------- */

.idf-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 16px;
	padding-top: calc(10px + env(safe-area-inset-top, 0px));
}

.idf-title {
	font-weight: 600;
	letter-spacing: .02em;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	margin-right: 12px;
}

.idf-icon-btn {
	min-width: 44px;
	min-height: 44px;
	border: 1px solid var(--idf-accent);
	border-radius: 50%;
	background: transparent;
	color: var(--idf-fg);
	font-size: 20px;
	cursor: pointer;
}

.idf-icon-btn[aria-pressed="true"] { background: var(--idf-accent); color: var(--idf-bg); }

/* ---------- Écrans ---------- */

.idf-screen {
	max-width: 560px;
	margin: 0 auto;
	padding: 16px;
}

.idf-screen h1 { font-size: 28px; margin: 8px 0 12px; }

.idf-lead { color: var(--idf-muted); margin: 0 0 24px; }

.idf-screen--msg { text-align: center; padding-top: 20vh; }

/* ---------- Formulaire ---------- */

label { display: block; font-weight: 600; margin-bottom: 6px; }

input[type="text"] {
	width: 100%;
	min-height: 52px;
	padding: 12px 14px;
	margin-bottom: 18px;
	border: 2px solid var(--idf-accent);
	border-radius: var(--idf-radius);
	background: var(--idf-surface);
	color: var(--idf-fg);
	font: inherit;
	font-size: 18px; /* ≥ 16 px : pas de zoom automatique sur iOS */
}

input[type="text"]:focus { outline: 3px solid var(--idf-fg); outline-offset: 2px; }

.idf-check { display: flex; align-items: flex-start; font-weight: 400; color: var(--idf-muted); margin-bottom: 18px; }
.idf-check input { width: 24px; height: 24px; margin: 0 12px 0 0; flex: 0 0 auto; }

.idf-error { color: var(--idf-error); min-height: 1.4em; margin: 0 0 8px; }

.idf-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 56px;
	padding: 12px 20px;
	border: 0;
	border-radius: var(--idf-radius);
	background: var(--idf-fg);
	color: var(--idf-bg);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.idf-btn:disabled { opacity: .5; }

/* ---------- Viseur ---------- */

.idf-screen--camera { padding-top: 0; }

/* Écran de prise de vue : tout tient dans l'écran, aucun défilement ni rebond (html.idf-lock posé par guest.js). */
html.idf-lock,
html.idf-lock body.idf {
	height: 100%;
	overflow: hidden;
	overscroll-behavior: none;
}

html.idf-lock body.idf {
	position: fixed;
	top: 0; right: 0; bottom: 0; left: 0;
	min-height: 0;
	height: 100vh;
	height: 100dvh;
	display: flex;
	flex-direction: column;
	touch-action: manipulation; /* pas de zoom au double toucher */
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
}

html.idf-lock body.idf > * { flex: 0 0 auto; }

html.idf-lock body.idf > .idf-screen--camera {
	flex: 1 1 auto;
	min-height: 0;
	width: 100%;
	display: flex;
	flex-direction: column;
	padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

html.idf-lock .idf-vf-wrap {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	container-type: size;
}

html.idf-lock .idf-viewfinder {
	max-height: none;
	width: min(100%, 60vh); /* repli sans unités de conteneur */
	width: min(100cqw, 100cqh * 2 / 3); /* plus grand cadre 2:3 qui tient dans la place restante */
}

html.idf-lock .idf-controls { padding-top: 10px; padding-bottom: 4px; }
html.idf-lock .idf-status,
html.idf-lock .idf-reveal-in { margin: 2px 0; }

.idf-viewfinder {
	position: relative;
	width: 100%;
	height: 0;
	padding-top: 150%; /* 2:3, format des tirages 10×15 à 20×30, sans aspect-ratio */
	max-height: 70vh;
	overflow: hidden;
	border-radius: var(--idf-radius);
	background: #000;
}

@supports (aspect-ratio: 2 / 3) {
	.idf-viewfinder { height: auto; padding-top: 0; aspect-ratio: 2 / 3; }
}

.idf-viewfinder video {
	position: absolute;
	top: 0; left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.idf-mirror { transform: scaleX(-1); }

/* Cadre façon visée argentique */
.idf-frame {
	position: absolute;
	top: 6%; right: 6%; bottom: 6%; left: 6%;
	border: 1px solid rgba(255, 255, 255, .55);
	border-radius: 6px;
	pointer-events: none;
}

.idf-flash {
	position: absolute;
	top: 0; right: 0; bottom: 0; left: 0;
	background: #fff;
	opacity: 0;
	pointer-events: none;
}

.idf-flash.is-on { animation: idf-flash .35s ease-out; }

@keyframes idf-flash { from { opacity: .9; } to { opacity: 0; } }

.idf-controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 4px 8px;
}

.idf-controls > * { flex: 1 1 0; }
.idf-controls > .idf-shutter { flex: 0 0 auto; }
.idf-controls > .idf-icon-btn { flex: 0 0 auto; margin-left: auto; }

.idf-counter {
	font-family: "Courier New", ui-monospace, monospace;
	font-weight: 700;
	font-size: 15px;
	letter-spacing: .05em;
}

.idf-shutter {
	width: 84px;
	height: 84px;
	margin: 0 16px;
	border: 6px solid var(--idf-accent);
	border-radius: 50%;
	background: var(--idf-fg);
	cursor: pointer;
	transition: transform .1s;
}

.idf-shutter:active { transform: scale(.92); }
.idf-shutter:disabled { opacity: .35; }
.idf-shutter:focus-visible { outline: 3px solid var(--idf-fg); outline-offset: 4px; }

.idf-status, .idf-reveal-in { text-align: center; color: var(--idf-muted); margin: 6px 0; min-height: 1.4em; }
.idf-reveal-in { font-family: "Courier New", ui-monospace, monospace; }

.idf-fallback { text-align: center; padding: 24px 0; }

/* ---------- Galerie ---------- */

.idf-grid { display: flex; flex-wrap: wrap; margin: 0 -4px; }

.idf-photo { width: 50%; padding: 4px; margin: 0; }

.idf-photo img { display: block; width: 100%; height: auto; border-radius: 6px; background: var(--idf-surface); }

.idf-photo figcaption { font-size: 13px; color: var(--idf-muted); padding: 4px 2px; }
.idf-photo a { color: inherit; }

/* Animation de « développement » à la révélation */
.idf-develop { animation: idf-develop 1.6s ease-out both; }

@keyframes idf-develop {
	from { opacity: 0; -webkit-filter: sepia(1) brightness(1.8) blur(4px); filter: sepia(1) brightness(1.8) blur(4px); }
	to { opacity: 1; -webkit-filter: none; filter: none; }
}

@media (min-width: 600px) {
	.idf-photo { width: 33.333%; }
}

@media (prefers-reduced-motion: reduce) {
	.idf-develop, .idf-flash.is-on { animation: none; }
	.idf-shutter { transition: none; }
}

/* Application installable */
.idf-install { min-height: 36px; padding: 6px 14px; margin-right: 8px; border: 2px solid var(--idf-fg); border-radius: 99px; background: transparent; color: var(--idf-fg); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.idf-tip { display: flex; align-items: center; margin: 0 16px 8px; padding: 10px 6px 10px 14px; border-radius: var(--idf-radius); background: var(--idf-surface); color: var(--idf-fg); font-size: 15px; }
.idf-tip span { flex: 1 1 auto; }

.idf-review-note { margin: 0 0 14px; padding: 10px 12px; border-radius: var(--idf-radius); background: var(--idf-surface); color: var(--idf-muted); font-size: 15px; }

/* Offre photographes : « offert par » en haut des pages invités */
.idf-brand { display: flex; align-items: center; margin: 0 16px 10px; padding: 10px 14px; border-left: 4px solid var(--idf-brand, #1f2a37); border-radius: var(--idf-radius); background: var(--idf-surface); }
.idf-brand-logo { max-height: 44px; max-width: 120px; width: auto; margin-right: 12px; }
.idf-brand-text { margin: 0; font-size: 15px; line-height: 1.35; }
.idf-brand-text span { color: var(--idf-muted); }

/* Démonstration publique */
.idf-demo-note { margin: 0 16px 10px; padding: 10px 14px; border-radius: var(--idf-radius); background: #fff2c9; color: #4a3800; font-size: 15px; }

/* Pack tirages dans la galerie */
.idf-prints { margin: 24px 0; padding: 16px; border-radius: var(--idf-radius); background: var(--idf-surface); }
.idf-print-form select { display: block; width: 100%; min-height: 48px; margin: 0 0 12px; padding: 10px; border-radius: var(--idf-radius); font: inherit; }

/* ---------- Jeux photo (bouton dans l'en-tête, panneau plein écran qui défile seul) ---------- */
.idf-games-btn { min-height: 36px; padding: 6px 14px; margin-right: 8px; border: 0; border-radius: 99px; background: var(--idf-fg); color: var(--idf-bg); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.idf-games { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 50; display: flex; flex-direction: column; background: var(--idf-bg); color: var(--idf-fg); padding-top: env(safe-area-inset-top, 0px); }
.idf-games-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--idf-line, rgba(0, 0, 0, .12)); }
.idf-games-head h2 { margin: 0; font-size: 20px; }
.idf-games-body { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 8px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
.idf-game { margin: 14px 0 24px; }
.idf-game h3 { margin: 0 0 4px; font-size: 19px; }
.idf-game-rules { margin: 0 0 12px; color: var(--idf-muted); font-size: 15px; }
.idf-game-score { margin: 10px 0 0; font-weight: 700; font-size: 15px; }
.idf-game.is-won .idf-game-score { color: var(--idf-error); font-size: 18px; }
.idf-bingo { display: grid; gap: 6px; }
.idf-bingo--3 { grid-template-columns: repeat(3, 1fr); }
.idf-bingo--4 { grid-template-columns: repeat(4, 1fr); }
.idf-bingo-cell { display: flex; align-items: center; justify-content: center; min-height: 72px; padding: 6px; border: 2px solid var(--idf-fg); border-radius: 10px; text-align: center; font-size: 13px; line-height: 1.2; cursor: pointer; }
.idf-bingo-cell[aria-pressed="true"] { background: var(--idf-fg); color: var(--idf-bg); }
.idf-game-list { list-style: none; margin: 0; padding: 0; }
.idf-game-list li { position: relative; padding: 12px 12px 12px 44px; border-bottom: 1px solid var(--idf-line, rgba(0, 0, 0, .1)); cursor: pointer; }
.idf-game-list li::before { content: ""; position: absolute; left: 8px; top: 12px; width: 22px; height: 22px; border: 2px solid var(--idf-fg); border-radius: 6px; }
.idf-game-list li[aria-pressed="true"] { color: var(--idf-muted); text-decoration: line-through; }
.idf-game-list li[aria-pressed="true"]::before { background: var(--idf-fg); }
.idf-game-list li.is-now { font-weight: 700; }
.idf-now { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 99px; background: var(--idf-fg); color: var(--idf-bg); font-size: 12px; text-decoration: none; }
.idf-mission { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 22px 18px; border: 2px dashed var(--idf-fg); border-radius: var(--idf-radius); background: var(--idf-surface); color: var(--idf-fg); font: inherit; text-align: left; cursor: pointer; }
.idf-mission-label { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--idf-muted); }
.idf-mission strong { font-size: 20px; line-height: 1.3; }
