/*
Theme Name:        MagnyStock
Theme URI:         https://www.magny-les-hameaux.fr
Author:            Direction des Services Techniques - Ville de Magny-les-Hameaux
Author URI:        https://www.magny-les-hameaux.fr
Description:       Thème minimal dédié à MagnyStock : portail public non authentifié, continuité visuelle de la connexion WordPress et identité MagnyStock. Aucune règle métier, aucune donnée de stock, d'achat ou de budget ne transite par ce thème.
Version:           1.9.1
Requires at least: 6.4
Requires PHP:      8.1
License:           GPL-2.0-or-later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:       magnystock-theme

Ce thème est volontairement minimal (docs/product/CAHIER_DES_CHARGES.md
§ « Thème WordPress MagnyStock »). Il ne porte aucune logique de stock,
d'achat, de budget ou d'autorisation métier : cette logique appartient au
plugin `MagnyStock`, qui reste seul responsable des données, de l'API et des
autorisations. Si ce thème est absent ou désactivé, le plugin ne perd
aucune donnée métier et continue de servir l'application via
`?magnystock_app=...` (DECISIONS.md DEC-015).
*/

/*
 * Feuille de style unique du thème. Aucun préprocesseur, aucune étape de
 * compilation, aucune dépendance CDN : le fichier est directement
 * servable (CLAUDE.md « Aucun appel réseau ou CDN obligatoire »).
 *
 * Jetons de couleur repris de docs/ui/DESIGN_SYSTEM.md, identiques à ceux
 * de assets/app/magnystock-app.css, afin que la connexion et l'application
 * partagent la même identité visuelle sans dupliquer de logique.
 */

:root {
	--slt-navy: #0b2e59;
	--slt-blue: #1268e8;
	--slt-green: #36b764;
	--slt-red: #e94b4b;
	--slt-bg: #f4f7fb;
	--slt-border: #e3e9f2;
	--slt-text: #1c2b3f;
	--slt-muted: #5b6b80;
	--slt-radius: 10px;
}

* {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	min-height: 100vh;
	background: var(--slt-bg);
	color: var(--slt-text);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.5;
}

img {
	max-width: 100%;
}

a {
	color: var(--slt-blue);
}

:focus-visible {
	outline: 3px solid var(--slt-blue);
	outline-offset: 2px;
}

.slt-skip {
	position: absolute;
	left: -9999px;
	top: 0;
	background: #fff;
	padding: 12px 16px;
	z-index: 100;
	border-radius: 0 0 var(--slt-radius) 0;
}

.slt-skip:focus {
	left: 8px;
	top: 8px;
}

/* ---------- Portail (maquettes 18 et 19) ---------- */

.slt-portal {
	position: relative;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background: #0b2039 url("assets/images/magnystock-login-background-v1.webp") center/cover no-repeat fixed;
}

.slt-portal::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg, rgba(4, 18, 36, .76) 0%, rgba(4, 18, 36, .36) 39%, rgba(4, 18, 36, .04) 66%, rgba(4, 18, 36, .10) 100%);
	pointer-events: none;
}

.slt-portal__main {
	position: relative;
	z-index: 1;
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	padding: 28px 5.2% 96px;
}

.slt-login-eyebrow {
	color: var(--slt-blue);
	font-size: 11px;
	font-weight: 750;
	letter-spacing: .1em;
	text-transform: uppercase;
}

.slt-brand {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	text-align: center;
}

.slt-brand__logo {
	height: auto;
	width: min(280px, 90%);
}

.slt-brand__wordmark {
	font-size: 28px;
	font-weight: 700;
	color: var(--slt-navy);
	letter-spacing: 0.02em;
}

.slt-brand__tagline {
	margin: 0;
	color: #40536a;
	font-size: 14px;
	max-width: 28em;
}

.slt-brand__divider {
	display: block;
	width: 40px;
	height: 3px;
	margin: 2px auto 0;
	border-radius: 2px;
	background: var(--slt-blue);
}

.slt-card {
	background: rgba(255, 255, 255, .985);
	border: 1px solid rgba(11, 46, 89, .14);
	border-top: 4px solid var(--slt-blue);
	border-radius: 16px;
	padding: 26px 32px 22px;
	width: 100%;
	max-width: 440px;
	text-align: center;
	display: flex;
	flex-direction: column;
	gap: 11px;
	box-shadow: 0 24px 70px rgba(1, 15, 32, .28);
}

.slt-login-card h1,
.slt-login-card p {
	margin: 0;
}

.slt-login-card h1 {
	font-size: 27px;
	color: var(--slt-navy);
}

.slt-login-card > p:not(.slt-login-eyebrow):not(.slt-login-secure) {
	color: #40536a;
	font-size: 15px;
}

.slt-login-form {
	display: grid;
	gap: 10px;
	text-align: left;
}

.slt-login-form label {
	font-size: 14px;
	font-weight: 650;
	color: var(--slt-navy);
}

.slt-login-form input[type="text"],
.slt-login-form input[type="password"] {
	width: 100%;
	min-height: 48px;
	padding: 10px 12px;
	border: 1px solid #9fb0c5;
	border-radius: var(--slt-radius);
	font: inherit;
	font-size: 16px;
	background: #fff;
	color: var(--slt-text);
	box-shadow: inset 0 1px 2px rgba(11, 46, 89, .05);
}

.slt-login-form input[type="text"]:focus,
.slt-login-form input[type="password"]:focus {
	border-color: var(--slt-blue);
	box-shadow: 0 0 0 3px rgba(18, 104, 232, .16);
	outline: 0;
}

.slt-login-remember {
	display: flex;
	align-items: center;
	gap: 9px;
	min-height: 36px;
	font-weight: 500 !important;
}

.slt-login-remember input {
	width: 20px;
	height: 20px;
}

.slt-login-options {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	font-size: 13px;
}

.slt-login-options a { white-space: nowrap; }

.slt-login-secure {
	padding-top: 13px;
	border-top: 1px solid var(--slt-border);
	color: var(--slt-muted);
	font-size: 13px;
}

.slt-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 10px 20px;
	border-radius: var(--slt-radius);
	background: var(--slt-blue);
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	text-decoration: none;
	border: 0;
}

.slt-button:hover,
.slt-button:focus-visible {
	background: var(--slt-navy);
	color: #fff;
}

.slt-notice {
	border-radius: var(--slt-radius);
	padding: 12px 16px;
	text-align: left;
}

.slt-notice--error {
	background: #fdecec;
	color: #7a1f1f;
	border: 1px solid var(--slt-red);
}

/* ---------- Bloc municipal (identité obligatoire) ---------- */

.slt-footer {
	position: absolute;
	z-index: 1;
	left: 5.2%;
	bottom: 24px;
	padding: 0;
}

.slt-city {
	display: flex;
	align-items: center;
	column-gap: 12px;
	display: grid;
	grid-template-columns: 48px auto;
	text-align: left;
	color: #fff;
	font-size: 13px;
	min-width: 310px;
	padding: 11px 16px;
	border: 1px solid rgba(255, 255, 255, .24);
	border-radius: 12px;
	background: rgba(4, 18, 36, .82);
	box-shadow: 0 10px 30px rgba(1, 15, 32, .2);
}

.slt-city__mark {
	grid-row: 1 / 3;
	height: 46px;
	width: auto;
}

.slt-city__name {
	margin: 0;
	font-weight: 600;
	color: #fff;
}

.slt-city__dept {
	margin: 0;
	color: #cfe0f5;
}

/* ---------- Page de connexion WordPress (login_enqueue_scripts) ---------- */

body.login {
	position: relative;
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	padding: 32px 5.2%;
	background: #0b2039 url("assets/images/magnystock-login-background-v1.webp") center/cover no-repeat fixed;
}

body.login::before {
	content: "";
	position: fixed;
	inset: 0;
	background: linear-gradient(90deg, rgba(4, 18, 36, .68), rgba(4, 18, 36, .08));
	pointer-events: none;
}

body.login #login {
	position: relative;
	z-index: 1;
	width: min(440px, calc(100% - 32px));
	margin: 0;
	padding: 26px 32px 24px;
	border: 1px solid rgba(11, 46, 89, .14);
	border-top: 4px solid var(--slt-blue);
	border-radius: 16px;
	background: rgba(255, 255, 255, .985);
	box-shadow: 0 24px 70px rgba(1, 15, 32, .28);
}

body.login #login h1 a {
	background-image: url("assets/logos/magnystock-logo.svg");
	background-size: contain;
	background-position: center;
	width: min(280px, 90%);
	height: 68px;
	margin-bottom: 12px;
	text-indent: 0;
	font-size: 0;
	font-weight: 700;
	color: var(--slt-navy);
}

body.login form {
	margin: 0;
	padding: 12px 0 0;
	border: 0;
	background: transparent;
	box-shadow: none;
}

body.login form .input,
body.login input[type="text"] {
	min-height: 48px;
	border: 1px solid #9fb0c5;
	border-radius: var(--slt-radius);
	background: #fff;
	color: var(--slt-text);
	font-size: 16px;
}

body.login .button-primary {
	background: var(--slt-blue);
	border-color: var(--slt-navy);
	border-radius: var(--slt-radius);
	min-height: 44px;
}

body.login #backtoblog,
body.login #nav {
	text-align: center;
}

body.login #backtoblog a,
body.login #nav a,
body.login .privacy-policy-page-link a { color: var(--slt-navy); text-shadow: none; }

body.login .language-switcher {
	position: relative;
	z-index: 1;
}

/* ---------- Responsive (à partir de 360 px) ---------- */

@media (max-width: 430px) {
	.slt-portal {
		background-attachment: scroll;
		background-position: 62% center;
	}

	.slt-portal::before { background: rgba(4, 18, 36, .58); }

	.slt-portal__main {
		justify-content: center;
		padding: 24px 16px 110px;
	}

	.slt-card {
		padding: 24px 20px;
	}

	.slt-login-options { align-items: flex-start; flex-direction: column; gap: 4px; }

	.slt-footer {
		left: 50%;
		bottom: 22px;
		width: max-content;
		max-width: calc(100% - 32px);
		transform: translateX(-50%);
	}

	.slt-city {
		min-width: 0;
		width: 100%;
	}

	.slt-brand__wordmark {
		font-size: 24px;
	}

	body.login {
		align-items: flex-start;
		justify-content: center;
		padding: 24px 0;
		background-attachment: scroll;
		background-position: 62% center;
	}

	body.login #login { padding: 24px 20px; }
}
