/*
Theme Name: Manuel OpenSi (moderne)
Description: Présentation moderne du manuel utilisateur OpenSi, inspirée d'opensi.fr. Le contenu des pages importées de CMS Made Simple est affiché tel quel ; seules la mise en page et les polices changent.
Version: 2.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: manuel-opensi
*/

/* ===== Charte (couleurs et polices d'opensi.fr) ===== */
:root {
	--blue: #10253e;
	--blue-70: rgba(16, 37, 62, .7);
	--muted: #5b6b7f;
	--line: #e3e8ef;
	--line-soft: rgba(16, 37, 62, .06);
	--orange: #ff4320;
	--orange-dark: #e5340f;
	--orange-light: #ff8c39;
	--beige: #ffefe5;
	--surface: #ffffff;
	--surface-2: #f6f8fb;
	--radius: 20px;
	--radius-sm: 10px;
	--shadow: 0 1px 2px rgba(16, 37, 62, .04), 0 10px 30px rgba(16, 37, 62, .06);
	--shadow-lg: 0 2px 4px rgba(16, 37, 62, .05), 0 18px 40px rgba(16, 37, 62, .12);
	--font: "Inter", "Segoe UI", Arial, sans-serif;
	--font-title: "Figtree", "Inter", "Segoe UI", Arial, sans-serif;
	--header-h: 128px;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
	margin: 0;
	font: 400 16px/1.6 var(--font);
	color: var(--blue);
	background: linear-gradient(180deg, #fff4ee 0, var(--surface-2) 520px) no-repeat, var(--surface-2);
	-webkit-font-smoothing: antialiased;
}
a { color: var(--orange); text-decoration: none; }
a:hover { color: var(--orange-dark); }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 4px; }
svg { display: block; }
.icon { width: 20px; height: 20px; }
.container { width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 32px; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: var(--radius-sm); background: var(--blue); color: #fff; }
.skip-link:focus { top: 12px; color: #fff; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); }

/* ===== Boutons ===== */
.btn {
	display: inline-flex; align-items: center; gap: 6px;
	height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 6px;
	font: 500 15px/1 var(--font); cursor: pointer; white-space: nowrap;
	transition: background-color .15s, color .15s, border-color .15s;
}
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); color: #fff; }
.btn-outline { border-color: var(--orange); color: var(--orange); background: transparent; }
.btn-outline:hover { background: var(--orange); color: #fff; }
.btn-light { background: var(--surface-2); color: var(--blue); border-color: var(--line); height: 36px; font-size: 14px; }
.btn-light:hover { border-color: var(--orange); color: var(--orange); }
.badge, .eyebrow {
	display: inline-block; padding: 3px 12px; border-radius: 999px;
	background: var(--orange-light); color: #fff;
	font: 600 12px/1.6 var(--font); letter-spacing: .06em; text-transform: uppercase;
}
.eyebrow { background: var(--beige); color: var(--orange); }

/* ===== Recherche ===== */
.search-form { position: relative; display: flex; align-items: center; }
.search-form .icon { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search-form input {
	width: 100%; height: 42px; padding: 0 16px 0 42px;
	border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2);
	font: 400 15px var(--font); color: var(--blue);
	transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.search-form input::placeholder { color: var(--muted); }
.search-form input:focus { outline: none; border-color: var(--orange); background: #fff; box-shadow: 0 0 0 4px rgba(255, 67, 32, .12); }

/* ===== En-tête ===== */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .96); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line); }
.admin-bar .site-header { top: 32px; }
.header-bar { display: flex; align-items: center; gap: 32px; height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; color: var(--blue); }
.brand:hover { color: var(--blue); }
.brand-logo { height: 36px; width: auto; }
.brand-wordmark { font: 700 30px/1 var(--font-title); letter-spacing: -.02em; color: var(--blue); }
.brand-wordmark span { color: var(--orange); }
.brand-label { padding: 4px 10px; border-radius: 999px; background: var(--beige); color: var(--orange); font: 600 12px/1.4 var(--font); letter-spacing: .02em; }
.header-search { flex: 1; max-width: 520px; margin-left: auto; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.menu-toggle { display: none; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--blue); font: 500 15px var(--font); cursor: pointer; }
.menu-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* Menu des rubriques */
.main-nav { border-top: 1px solid var(--line-soft); }
.nav-menu { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.nav-item { position: relative; }
.nav-item > a {
	display: flex; align-items: center; gap: 6px; height: 55px; padding: 0 14px;
	color: var(--blue); font: 500 15px var(--font);
	border-bottom: 2px solid transparent;
}
.nav-item.has-dropdown > a::after {
	content: ""; width: 7px; height: 7px; margin-top: -4px;
	border-right: 1.6px solid var(--orange); border-bottom: 1.6px solid var(--orange); transform: rotate(45deg);
}
.nav-item > a:hover, .nav-item:focus-within > a { color: var(--orange); }
.nav-item.is-active > a { color: var(--orange); border-bottom-color: var(--orange); }
.dropdown {
	position: absolute; top: 100%; left: 0; z-index: 60; min-width: 280px; padding-top: 6px;
	visibility: hidden; opacity: 0; transform: translateY(6px); transition: opacity .15s, transform .15s, visibility .15s;
}
.nav-item:hover .dropdown, .nav-item:focus-within .dropdown { visibility: visible; opacity: 1; transform: none; }
.dropdown ul { margin: 0; padding: 8px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); }
.dropdown a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--blue); font-size: 14px; }
.dropdown a:hover, .dropdown .is-active a { background: var(--beige); color: var(--orange); }

/* Menu mobile */
.mobile-panel { max-height: calc(100vh - 72px); overflow-y: auto; padding: 16px 20px 24px; border-top: 1px solid var(--line); background: #fff; }
.mobile-panel .search-form { margin-bottom: 16px; }

/* ===== Mise en page ===== */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; padding-top: 32px; padding-bottom: 72px; }
.layout.has-sidebar { grid-template-columns: 280px minmax(0, 1fr); }

/* Barre latérale */
.sidebar { position: relative; }
.sidebar-box { position: sticky; top: calc(var(--header-h) + 24px); max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; padding: 16px 12px; background: #fff; border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow); }
.admin-bar .sidebar-box { top: calc(var(--header-h) + 56px); }
.sidebar-box summary { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; margin-bottom: 8px; border-bottom: 1px solid var(--line); list-style: none; cursor: default; }
.sidebar-box summary::-webkit-details-marker { display: none; }
.sidebar-box summary a { color: var(--blue); font: 700 17px/1.3 var(--font-title); }
.sidebar .section-icon { width: 36px; height: 36px; }
.sidebar .section-icon .icon { width: 18px; height: 18px; }

/* Arborescence (barre latérale et menu mobile) */
.tree { margin: 0; padding: 0; list-style: none; }
.tree .tree { display: none; margin: 2px 0 6px 14px; padding-left: 10px; border-left: 1px solid var(--line); }
.tree li.is-open > .tree { display: block; }
.tree-row { display: flex; align-items: center; gap: 4px; }
.tree-row a { flex: 1; padding: 6px 10px; border-radius: 8px; color: var(--blue); font-size: 14px; line-height: 1.4; }
.tree-row a:hover { background: var(--surface-2); color: var(--orange); }
.tree li.is-current > .tree-row a { background: var(--beige); color: var(--orange); font-weight: 600; }
.tree-depth-0 > li > .tree-row a { font-weight: 500; }
.tree-toggle { display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.tree-toggle:hover { background: var(--surface-2); color: var(--orange); }
.tree-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.tree-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }

/* Carte de contenu */
.doc { min-width: 0; padding: 28px 48px 48px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow); }
.doc-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-bottom: 20px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin-right: 4px; color: #a7b2bf; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--orange); }
.breadcrumbs [aria-current] { color: var(--blue); font-weight: 500; }
.doc-tools { display: flex; align-items: center; gap: 8px; }
.page-search { position: relative; display: flex; align-items: center; }
.page-search .icon { position: absolute; left: 11px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.page-search input { width: 190px; height: 36px; padding: 0 12px 0 32px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); font: 400 14px var(--font); color: var(--blue); }
.page-search input:focus { outline: none; border-color: var(--orange); background: #fff; }
.doc-title { margin: 10px 0 28px; font: 700 36px/1.2 var(--font-title); letter-spacing: -.01em; color: var(--blue); }

/* Pages précédente / suivante */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line); }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 14px; color: var(--blue); font-weight: 600; transition: border-color .15s, box-shadow .15s; }
.pager a:hover { border-color: var(--orange); box-shadow: var(--shadow); color: var(--orange); }
.pager small { color: var(--muted); font-weight: 400; font-size: 13px; }
.pager-prev small::before { content: "← "; }
.pager-next { grid-column: 2; text-align: right; }
.pager-next small::after { content: " →"; }

/* ===== Contenu importé (HTML CMSMS / Word, non modifié) ===== */
.entry-content { font-size: 15px; line-height: 1.7; color: var(--blue); overflow-wrap: break-word; }
/* Police unique : remplace Calibri, Arial, Verdana… imposés dans le HTML */
.entry-content, .entry-content * { font-family: var(--font) !important; }
/* Tailles héritées de Word et de l'éditeur CMSMS ramenées à une échelle lisible */
.entry-content [style*="font-size: small"], .entry-content [style*="font-size:small"],
.entry-content [style*="font-size: medium"], .entry-content [style*="font-size:medium"],
.entry-content [style*="font-size: 10pt"], .entry-content [style*="font-size: 10.0pt"],
.entry-content [style*="font-size: 11pt"], .entry-content [style*="font-size: 11.0pt"],
.entry-content [style*="font-size:11pt"], .entry-content [style*="font-size:11.0pt"],
.entry-content [style*="font-size: 12pt"], .entry-content [style*="font-size: 12.0pt"],
.entry-content [style*="font-size: 0.8em"], .entry-content [style*="font-size: 13px"] { font-size: 15px !important; }
.entry-content [style*="font-size: x-small"], .entry-content [style*="font-size:x-small"] { font-size: 13px !important; }
.entry-content [style*="font-size: 14pt"], .entry-content [style*="font-size: 14.0pt"],
.entry-content [style*="font-size: large"] { font-size: 19px !important; }
.entry-content [style*="line-height"] { line-height: 1.7 !important; }
/* Tabulations Word (white-space: pre) : espaces conservés, mais retour à la ligne permis sur petit écran */
.entry-content [style*="white-space: pre"], .entry-content [style*="white-space:pre"] { white-space: pre-wrap !important; }

.entry-content p { margin: 0 0 .85em; }
.entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4 { margin: 1.6em 0 .6em; font-family: var(--font-title) !important; font-weight: 700; line-height: 1.3; color: var(--blue); }
.entry-content h1 { font-size: 28px; }
.entry-content h2 { font-size: 24px; }
.entry-content h3 { font-size: 20px; }
.entry-content h4 { font-size: 17px; }
.entry-content strong, .entry-content b { font-weight: 600; }
.entry-content em, .entry-content i { font-style: italic; }
.entry-content a { color: var(--orange); text-decoration: underline; text-decoration-color: rgba(255, 67, 32, .35); text-underline-offset: 3px; }
.entry-content a:hover { text-decoration-color: currentColor; }
.entry-content ul, .entry-content ol { margin: 0 0 1em; padding-left: 1.5em; }
.entry-content li { margin: .25em 0; }
.entry-content ul li::marker { color: var(--orange); }
.entry-content ol li::marker { color: var(--orange); font-weight: 600; }
.entry-content img { max-width: 100%; height: auto; vertical-align: middle; }
.entry-content table { max-width: 100%; margin: 0 0 1.2em; border-collapse: collapse; }
.entry-content td, .entry-content th { padding: 8px 12px; border: 1px solid var(--line); vertical-align: top; }
.entry-content th { background: var(--surface-2); font-weight: 600; text-align: left; }
.entry-content span.hilite { background: #ffe08a; border-radius: 3px; box-shadow: 0 0 0 2px #ffe08a; }

/* ===== Accueil ===== */
.hero { padding: 64px 0 40px; text-align: center; }
.hero-inner { display: flex; flex-direction: column; align-items: center; }
.hero h1 { margin: 16px 0 12px; font: 700 52px/1.15 var(--font-title); letter-spacing: -.02em; }
.hero h1 span { color: var(--orange); }
.hero p { margin: 0 0 28px; font-size: 18px; color: var(--muted); }
.hero-search { width: 100%; max-width: 640px; }
.hero-search input { height: 56px; padding-left: 50px; font-size: 16px; background: #fff; box-shadow: var(--shadow); }
.hero-search .icon { left: 18px; width: 20px; height: 20px; }
.sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; padding-bottom: 32px; }
.section-card { display: flex; flex-direction: column; padding: 28px; background: #fff; border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--blue); transition: transform .15s, box-shadow .15s, border-color .15s; }
.section-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: rgba(255, 67, 32, .3); color: var(--blue); }
.section-card h3 { margin: 18px 0 8px; font: 700 21px/1.3 var(--font-title); }
.home-sections { padding-bottom: 40px; }
.home-sections-head { margin-bottom: 24px; text-align: center; }
.home-sections-head h2 { margin: 12px 0 0; font: 700 34px/1.2 var(--font-title); letter-spacing: -.01em; }
.section-card p { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.section-count { margin-top: auto; color: var(--orange); font-size: 13px; font-weight: 600; }
.section-icon { display: grid; place-items: center; width: 48px; height: 48px; flex-shrink: 0; border-radius: 50%; background: var(--orange); color: #fff; }
.section-icon .icon { width: 22px; height: 22px; }
.doc-home { margin: 32px 0 56px; }

/* Recherche */
.results-count { color: var(--muted); }
.results { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.results a { display: flex; flex-direction: column; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; color: var(--blue); transition: border-color .15s, background-color .15s; }
.results a:hover { border-color: var(--orange); background: #fffaf7; }
.results small { color: var(--muted); font-size: 13px; }
.results strong { font-weight: 600; font-size: 16px; }
.doc-404 { max-width: 720px; margin: 24px auto; text-align: center; }
.doc-404 .hero-search { margin: 0 auto 24px; }

/* ===== Pied de page ===== */
.site-footer { padding: 48px 0; background: var(--blue); color: rgba(255, 255, 255, .72); font-size: 14px; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 24px; }
.footer-brand .brand-wordmark { color: #fff; font-size: 26px; }
.footer-brand p { margin: 8px 0 0; }
.footer-links { display: flex; gap: 24px; margin: 0; padding: 0; list-style: none; }
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--orange-light); }
.footer-copy { flex-basis: 100%; margin: 16px 0 0; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: 13px; }
.to-top { position: fixed; right: 24px; bottom: 24px; z-index: 40; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--orange); color: #fff; box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity .2s, transform .2s, visibility .2s; }
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--orange-dark); color: #fff; }
.to-top svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ===== Écrans plus étroits ===== */
@media (max-width: 1180px) {
	.layout.has-sidebar { grid-template-columns: 240px minmax(0, 1fr); }
	.doc { padding: 24px 32px 40px; }
}
@media (max-width: 960px) {
	:root { --header-h: 72px; }
	.container { padding: 0 20px; }
	.main-nav, .header-search { display: none; }
	.header-actions { margin-left: auto; }
	.menu-toggle { display: inline-flex; }
	.layout.has-sidebar { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 20px; }
	.sidebar-box { position: static; max-height: none; }
	.sidebar-box summary { cursor: pointer; margin-bottom: 0; padding-bottom: 4px; border-bottom: 0; }
	.sidebar-box summary::after { content: ""; width: 8px; height: 8px; margin-left: auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); }
	.sidebar-box[open] summary { margin-bottom: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
	.sidebar-box[open] summary::after { transform: rotate(-135deg); }
	.hero { padding: 40px 0 28px; }
	.hero h1 { font-size: 36px; }
}
@media (max-width: 640px) {
	.btn-outline { display: none; }
	.brand-label { display: none; }
	.doc { padding: 20px 18px 32px; border-radius: 14px; }
	.doc-title { font-size: 27px; }
	.doc-tools, .page-search, .page-search input { width: 100%; }
	.page-search { flex: 1; }
	.pager { grid-template-columns: 1fr; }
	.pager-next { grid-column: auto; }
	.entry-content table { display: block; overflow-x: auto; }
	.sections { grid-template-columns: 1fr; }
}

/* ===== Impression ===== */
@media print {
	.site-header, .sidebar, .doc-toolbar, .pager, .site-footer, .to-top { display: none !important; }
	body { background: #fff; }
	.layout.has-sidebar { display: block; }
	.doc { padding: 0; border: 0; box-shadow: none; }
}
