/**
 * ie24 — Application web (PWA).
 *
 * Trois meubles, taillés dans la grammaire du journal :
 *  1. .lj-appbar     — barre d'onglets fixée en bas d'écran, visible seulement
 *     quand le site tourne en application (classe is-pwa posée par pwa.js,
 *     doublée de la requête média display-mode).
 *  2. .lj-appsheet   — panneau « Plus » : les sections qui ne tiennent pas
 *     dans la barre sur téléphone. Sur tablette, tout tient dans la barre.
 *  3. .lj-pwa-invite — bandeau d'invitation à installer, sur le site normal.
 *
 * @package ie24
 */

/* ======================================================================
   1. Barre d'application
   ====================================================================== */
.lj-appbar { display: none; }

html.is-pwa .lj-appbar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 120;
	display: flex;
	align-items: stretch;
	justify-content: space-around;
	height: calc(56px + env(safe-area-inset-bottom, 0px));
	padding: 3px max(0.4rem, env(safe-area-inset-left, 0px)) env(safe-area-inset-bottom, 0px) max(0.4rem, env(safe-area-inset-right, 0px));
	background: var(--paper);
	border-top: 1px solid var(--rule-strong);
	box-shadow: 0 -6px 18px rgba(22, 20, 13, 0.08);
}

/* Second filet fin sous le filet fort — la signature « presse ». */
html.is-pwa .lj-appbar::before {
	content: "";
	position: absolute;
	top: 2px;
	left: 0;
	right: 0;
	border-top: 1px solid var(--rule);
	pointer-events: none;
}

.lj-appbar-item {
	appearance: none;
	background: none;
	border: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.22rem;
	flex: 1 1 0;
	min-width: 0;
	padding: 0.2rem 0.15rem;
	color: var(--ink-mute);
	font-family: var(--font-sans);
	font-size: 0.58rem;
	font-weight: 600;
	letter-spacing: 0.13em;
	text-transform: uppercase;
	line-height: 1;
	text-decoration: none;
	border-radius: var(--radius);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: color var(--dur-fast) var(--ease);
}
.lj-appbar-item span {
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.lj-appbar-item svg {
	width: 22px;
	height: 22px;
	flex: none;
}
.lj-appbar-item:hover,
.lj-appbar-item:focus-visible { color: var(--ink); }

/* Onglet courant : encre pleine + trait oxblood, comme un onglet de rubrique. */
.lj-appbar-item.is-active { color: var(--ink); }
.lj-appbar-item.is-active::after {
	content: "";
	width: 16px;
	height: 2px;
	background: var(--accent);
	margin-top: 1px;
}

/* Place réservée au contenu au-dessus de la barre. */
html.is-pwa .lj-site {
	padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

/* En application sur téléphone : manchette resserrée, barre utilitaire tue. */
@media (max-width: 767px) {
	html.is-pwa { --fs-nameplate: clamp(2.1rem, 1rem + 5.4vw, 3rem); }
	html.is-pwa .lj-topbar { display: none; }
}

/* Téléphone : les sections « Plus » sortent de la barre. */
@media (max-width: 767px) {
	.lj-appbar-item--plus { display: none; }
}

/* Tablette et plus : tout tient dans la barre, le bouton « Plus » disparaît,
   et le Compte ferme la marche, comme dans toute application. */
@media (min-width: 768px) {
	.lj-appbar-more { display: none; }
	.lj-appsheet { display: none !important; }
	.lj-appbar-item { font-size: 0.62rem; }
	.lj-appbar-item--compte { order: 10; }
}

/* ======================================================================
   2. Panneau « Plus »
   ====================================================================== */
.lj-appsheet {
	position: fixed;
	inset: 0;
	z-index: 115;
	background: rgba(22, 20, 13, 0.38);
}

.lj-appsheet-panel {
	position: absolute;
	left: 0;
	right: 0;
	bottom: calc(56px + env(safe-area-inset-bottom, 0px));
	background: var(--paper);
	border-top: 1px solid var(--rule-strong);
	box-shadow: 0 -10px 30px rgba(22, 20, 13, 0.16);
	padding: 0.8rem 0.9rem 1rem;
	animation: lj-appsheet-monte var(--dur-fast) var(--ease);
}
@keyframes lj-appsheet-monte {
	from { transform: translateY(12px); opacity: 0; }
	to   { transform: translateY(0);    opacity: 1; }
}

.lj-appsheet-tete {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 0.15rem 0.55rem;
	border-bottom: 1px solid var(--rule);
	margin-bottom: 0.75rem;
}
.lj-appsheet-kicker {
	font-family: var(--font-sans);
	font-size: var(--fs-kicker);
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--accent);
}
.lj-appsheet-fermer {
	appearance: none;
	background: none;
	border: 0;
	padding: 0.25rem;
	color: var(--ink-mute);
	cursor: pointer;
	line-height: 0;
}
.lj-appsheet-fermer svg { width: 18px; height: 18px; }
.lj-appsheet-fermer:hover { color: var(--ink); }

.lj-appsheet-liste {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.55rem;
}
.lj-appsheet-item {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.7rem 0.75rem;
	background: var(--white);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	color: var(--ink);
	font-family: var(--font-sans);
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	text-decoration: none;
	-webkit-tap-highlight-color: transparent;
}
.lj-appsheet-item svg { width: 19px; height: 19px; flex: none; color: var(--ink-soft); }
.lj-appsheet-item:hover { border-color: var(--rule-strong); }
.lj-appsheet-item.is-active { border-color: var(--accent); }
.lj-appsheet-item.is-active svg { color: var(--accent); }

/* ======================================================================
   3. Invitation à installer (site normal uniquement)
   ====================================================================== */
.lj-pwa-invite {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 110;
	padding: 0 0.9rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
	pointer-events: none;
}
html.is-pwa .lj-pwa-invite { display: none !important; }

/* L'attribut hidden doit toujours l'emporter sur les display des classes. */
.lj-pwa-invite [hidden] { display: none !important; }

.lj-pwa-invite-box {
	pointer-events: auto;
	position: relative;
	max-width: 34rem;
	margin: 0 auto;
	background: var(--white);
	border: 1px solid var(--rule-strong);
	border-radius: var(--radius);
	box-shadow: 0 12px 32px rgba(22, 20, 13, 0.18);
	padding: 0.85rem 2.5rem 0.95rem 1.05rem;
	transform: translateY(130%);
	opacity: 0;
	transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.lj-pwa-invite.is-visible .lj-pwa-invite-box {
	transform: translateY(0);
	opacity: 1;
}

.lj-pwa-invite-kicker {
	margin: 0 0 0.25rem;
	font-family: var(--font-sans);
	font-size: var(--fs-kicker);
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--accent);
}
.lj-pwa-invite-kicker em { font-style: normal; color: var(--ink); }

.lj-pwa-invite-texte {
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.55;
	color: var(--ink-soft);
}

.lj-pwa-invite-ios {
	margin: 0.55rem 0 0;
	font-family: var(--font-sans);
	font-size: 0.8rem;
	color: var(--ink);
}
.lj-pwa-invite-picto { display: inline-block; }
.lj-pwa-invite-picto svg {
	display: inline-block; /* le reset du thème met les svg en bloc. */
	width: 15px;
	height: 15px;
	vertical-align: -2px;
	margin: 0 0.1rem;
}

.lj-pwa-invite-installer {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	margin-top: 0.7rem;
	padding: 0.55rem 0.95rem;
	background: var(--ink);
	color: var(--paper);
	border: 0;
	border-radius: var(--radius);
	font-family: var(--font-sans);
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background var(--dur-fast) var(--ease);
}
.lj-pwa-invite-installer svg { width: 16px; height: 16px; }
.lj-pwa-invite-installer:hover { background: var(--accent-ink); }

.lj-pwa-invite-fermer {
	position: absolute;
	top: 0.4rem;
	right: 0.4rem;
	appearance: none;
	background: none;
	border: 0;
	padding: 0.3rem;
	color: var(--ink-mute);
	cursor: pointer;
	line-height: 0;
}
.lj-pwa-invite-fermer svg { width: 16px; height: 16px; }
.lj-pwa-invite-fermer:hover { color: var(--ink); }

/* ======================================================================
   4. Cohabitation avec le sélecteur de langue flottant (GTranslate)
   ====================================================================== */
/* En application : le sélecteur se pose AU-DESSUS de la barre d'onglets,
   jamais dessus — et repasse sous le panneau « Plus » et son voile. */
html.is-pwa .gt_switcher_wrapper {
	bottom: calc(66px + env(safe-area-inset-bottom, 0px)) !important;
	top: auto !important;
	z-index: 112 !important;
}

/* Sur le site normal, quand le bandeau d'invitation est ouvert, le sélecteur
   remonte au-dessus de lui (hauteur mesurée par pwa.js), puis redescend. */
html.lj-invite-visible .gt_switcher_wrapper {
	bottom: calc(var(--lj-invite-h, 160px) + 8px) !important;
	top: auto !important;
	transition: bottom 0.3s ease;
}

/* ======================================================================
   5. Sobriété : impression et mouvement réduit
   ====================================================================== */
@media print {
	.lj-appbar,
	.lj-appsheet,
	.lj-pwa-invite { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
	.lj-pwa-invite-box { transition: none; }
	.lj-appsheet-panel { animation: none; }
}
