/**
 * Masthead and « Le sommaire » (design-system.md §5). Markup: inc/31-masthead.php · behaviour: assets/js/menu.js.
 * Mobile first: < 1024 px the drawer (dialog) is the menu; ≥ 1024 px the double-rule menu with panels.
 * Not sticky (house rule).
 */

.ae-mast { position: relative; z-index: 40; background: var(--ae-linen); }

/* Top line: encre strip. */
.ae-mast__top { background: var(--ae-ink); color: var(--ae-linen); }
.ae-mast__top-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 52px; }
.ae-mast__motto { margin: 0; font-family: var(--ae-serif); font-style: italic; font-size: 1.05rem; color: var(--ae-brass-light); white-space: nowrap; }
.ae-mast__search { display: none; }
.ae-mast__motto-more { display: none; }
.ae-mast__util-list { display: none; }
.ae-mast__devis {
	display: inline-flex; align-items: center; gap: 0.55rem; min-height: 44px; padding: 0 1rem; box-sizing: border-box;
	background: var(--ae-brass); color: var(--ae-ink); border-radius: var(--ae-radius);
	font-weight: 600; font-size: 0.9375rem; text-decoration: none; white-space: nowrap;
}
.ae-mast__devis::before { content: ""; width: 7px; height: 7px; background: var(--ae-ink); transform: rotate(45deg); flex: none; }
.ae-mast__devis:hover { background: var(--ae-linen); color: var(--ae-ink); }
.ae-mast__top :focus-visible { outline-color: var(--ae-brass-light); }

/* Brand row. */
.ae-mast__brand { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.75rem; padding-block: 0.9rem; }
.ae-mast__logo { justify-self: center; }
@media (min-width: 600px) { .ae-mast__brand { grid-template-columns: 1fr auto 1fr; } }
.ae-mast__logo { margin: 0; grid-column: 2; line-height: 0; }
.ae-mast__logo a { display: inline-flex; align-items: center; min-height: 44px; }
.ae-mast__logo img { width: 132px; height: auto; display: block; }
.ae-mast__tagline { display: none; }
.ae-mast__open, .ae-mast__search-toggle, .ae-mast__nojs-link {
	display: inline-flex; align-items: center; gap: 0.55rem; min-height: 44px; min-width: 44px; padding: 0 0.25rem; box-sizing: border-box;
	background: none; border: 0; color: var(--ae-ink); font: 600 0.875rem/1 var(--ae-sans); cursor: pointer; text-decoration: none;
}
.ae-mast__open { grid-column: 1; justify-self: start; grid-row: 1; }
.ae-mast__nojs-link { grid-column: 1; grid-row: 1; justify-self: start; }
.ae-mast__search-toggle { grid-column: 3; grid-row: 1; justify-self: end; justify-content: center; }
.ae-mast__open-mark { display: inline-grid; gap: 4px; width: 16px; }
.ae-mast__open-mark i { display: block; height: 1.5px; background: currentColor; }
.ae-mast__open-mark i:nth-child(2) { width: 70%; background: var(--ae-oxblood); }
.ae-mast__open:hover, .ae-mast__search-toggle:hover { color: var(--ae-oxblood); }
.ae-mast__search-toggle[aria-expanded="true"] { color: var(--ae-oxblood); }
html:not(.ae-js) .ae-mast__open, html:not(.ae-js) .ae-mast__search-toggle { display: none; }
.ae-js .ae-mast__nojs-link { display: none; }

.ae-mast__msearch { padding: 1rem 0 1.25rem; background: var(--ae-base); border-block: 1px solid var(--ae-line); }

/* Double-rule nav (≥ 1024). */
.ae-mast__nav { display: none; }
.ae-mast__brand + .ae-mast__msearch + .ae-mast__nav { margin: 0; }
.ae-mast::after { content: ""; display: block; height: 4px; border-top: 1px solid var(--ae-ink); border-bottom: 1px solid var(--ae-brass); }

/* Drawer: the table of contents. */
.ae-drawer {
	position: fixed; inset: 0 auto 0 0;
	width: 100%; max-width: 30rem; height: 100%; max-height: 100dvh;
	margin: 0; padding: 0; border: 0; box-sizing: border-box;
	background: var(--ae-linen); color: var(--ae-ink);
	overflow-y: auto; overscroll-behavior: contain;
}
.ae-drawer::backdrop { background: rgb(32 27 30 / 0.55); }
.ae-drawer[open] { animation: ae-drawer-in 0.28s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes ae-drawer-in { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
html.ae-drawer-open { overflow: hidden; }
.ae-drawer__head {
	position: sticky; top: 0; z-index: 1;
	display: flex; align-items: center; justify-content: space-between;
	padding: 0.5rem var(--ae-gutter); background: var(--ae-linen);
	border-bottom: 1px solid var(--ae-ink); box-shadow: 0 3px 0 var(--ae-linen), 0 4px 0 var(--ae-brass);
}
.ae-drawer__title { margin: 0; font-family: var(--ae-serif); font-style: italic; font-weight: 600; font-size: 1.75rem; line-height: 1.2; }
.ae-drawer__close { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 44px; padding: 0 0.5rem; background: none; border: 0; color: var(--ae-ink); font: 600 0.9375rem var(--ae-sans); cursor: pointer; }
.ae-drawer__close:hover { color: var(--ae-oxblood); }
.ae-drawer__body { padding: 1.5rem var(--ae-gutter) 1rem; }
.ae-drawer__search { margin-bottom: 1.5rem; }
.ae-drawer__kicker { margin: 0 0 0.5rem; font-weight: 700; font-size: 0.875rem; color: var(--ae-brass-text); }
.ae-toc { margin: 0; padding: 0; list-style: none; }
.ae-toc__icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--ae-oxblood); color: var(--ae-linen); box-shadow: inset 0 0 0 2px var(--ae-oxblood), inset 0 0 0 3px var(--ae-brass); }
.ae-toc__desc strong { font-weight: 700; color: var(--ae-blue); }
.ae-toc__item { padding: 1rem 0 1.1rem; border-top: 1px solid var(--ae-line); }
.ae-toc__item:first-child { border-top: 1px solid var(--ae-ink); }
.ae-toc__link { display: grid; grid-template-columns: 3.3rem 1fr auto; align-items: center; gap: 0.5rem; min-height: 44px; color: var(--ae-ink); text-decoration: none; }
.ae-toc__no { font-size: 1.05rem; }
.ae-toc__label { font-family: var(--ae-serif); font-weight: 600; font-size: clamp(1.45rem, 1.3rem + 0.8vw, 1.8rem); line-height: 1.08; letter-spacing: -0.015em; }
.ae-toc__link:hover .ae-toc__label, .ae-toc__link[aria-current] .ae-toc__label { color: var(--ae-oxblood); }
.ae-toc__desc { margin: 0.35rem 0 0 3.3rem; font-size: 0.9375rem; line-height: 1.5; color: var(--ae-taupe); }
.ae-toc__sub { margin: 0.6rem 0 0 3.3rem; padding: 0; list-style: none; }
.ae-toc__sub a { display: flex; align-items: center; gap: 0.55rem; min-height: 44px; padding: 0.3rem 0; box-sizing: border-box; color: var(--ae-ink); text-decoration: none; line-height: 1.35; }
.ae-toc__sub .ae-glyph { flex: none; color: var(--ae-blue); }
.ae-toc__sub .ae-count { margin-left: auto; }
.ae-toc__sub a:hover { color: var(--ae-oxblood); text-decoration: underline; }
.ae-toc__more { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin: 0.5rem 0 0; padding: 1rem 0 0 3.3rem; border-top: 1px solid var(--ae-line); list-style: none; }
.ae-toc__more a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; color: var(--ae-ink); }
.ae-drawer__foot { display: flex; gap: 1.1rem; align-items: center; margin: 1rem var(--ae-gutter) 2rem; padding: 1.25rem; background: var(--ae-ink); color: var(--ae-linen); }
.ae-drawer__foot .ae-seal { color: var(--ae-linen); }
.ae-drawer__foot-text { margin: 0 0 0.75rem; font-size: 0.9375rem; line-height: 1.5; }
.ae-drawer__foot :focus-visible { outline-color: var(--ae-brass-light); }

/* Tablet */
@media (min-width: 600px) {
	.ae-mast__logo img { width: 170px; }
	.ae-mast__brand { padding-block: 1.1rem; }
}

/* Laptop and desktop: the masthead. */
@media (min-width: 1024px) {
	.ae-mast__top-inner { display: grid; grid-template-columns: 1fr auto 1fr; min-height: 56px; }
	.ae-mast__search { display: flex; align-items: center; gap: 0.75rem; justify-self: start; }
	.ae-mast__search .ae-search__label { margin: 0; font-weight: 500; font-size: 0.875rem; color: var(--ae-linen); }
	.ae-mast__search .ae-search__row { width: 240px; }
	.ae-mast__search .ae-search__input { min-height: 38px; background: transparent; color: var(--ae-linen); border: 0; border-bottom: 1px solid rgb(245 239 230 / 0.55); border-radius: 0; padding: 0 0.25rem; }
	.ae-mast__search .ae-search__submit { width: 44px; min-height: 44px; background: transparent; border: 0; color: var(--ae-linen); }
	.ae-mast__search .ae-search__submit:hover { color: var(--ae-brass-light); background: transparent; }
	.ae-mast__motto { grid-column: 2; grid-row: 1; }
	.ae-mast__util { grid-column: 3; grid-row: 1; }
	.ae-mast__search { grid-column: 1; grid-row: 1; }

	.ae-mast__brand { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding-block: 1.75rem 1.25rem; }
	.ae-mast__logo img { width: 190px; }
	.ae-mast__tagline { display: block; margin: 0; font-family: var(--ae-serif); font-style: italic; font-size: 1.15rem; color: var(--ae-taupe); }
	.ae-mast__open, .ae-mast__search-toggle, .ae-mast__nojs-link, .ae-mast__msearch { display: none !important; }

	.ae-mast__nav { display: block; position: relative; border-top: 1px solid var(--ae-ink); box-shadow: inset 0 3px 0 var(--ae-linen), inset 0 4px 0 var(--ae-brass); }
	.ae-mast::after { height: 0; border-top: 0; border-bottom: 1px solid var(--ae-ink); }
	.ae-mast__row { display: flex; align-items: stretch; gap: 0; padding-top: 4px; }
	.ae-mast__item { display: flex; }
	.ae-mast__toggle {
		display: inline-flex; align-items: center; gap: 0.55rem; min-height: 64px; padding: 0 1.25rem 0 0; margin-right: 0.5rem; box-sizing: border-box;
		background: none; border: 0; border-right: 1px solid var(--ae-line); color: var(--ae-ink); font: 700 0.9375rem/1 var(--ae-sans); cursor: pointer; white-space: nowrap;
	}
	.ae-mast__toggle:hover, .ae-mast__toggle[aria-expanded="true"] { color: var(--ae-oxblood); }
	.ae-mast__toggle .ae-icon { width: 16px; height: 16px; transition: transform 0.2s ease; color: var(--ae-brass-text); }
	.ae-mast__toggle[aria-expanded="true"] .ae-icon { transform: rotate(180deg); }
	html:not(.ae-js) .ae-mast__item.has-panel { display: none; }
	.ae-mast__trades { flex: 1; display: flex; justify-content: space-between; margin: 0; padding: 0; list-style: none; }
	.ae-mast__trade { flex: 1 1 0; display: flex; }
	.ae-mast__trade a {
		position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem;
		min-height: 64px; padding: 0.5rem 0.25rem; box-sizing: border-box;
		color: var(--ae-ink); font-weight: 500; font-size: 0.875rem; line-height: 1.1; text-decoration: none; white-space: nowrap;
	}
	.ae-mast__trade .ae-glyph { color: var(--ae-blue); transition: color 0.18s ease, transform 0.18s ease; }
	.ae-mast__trade a::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: 0; height: 2px; background: var(--ae-oxblood); transform: scaleX(0); transition: transform 0.2s ease; }
	.ae-mast__trade a:hover, .ae-mast__trade a[aria-current] { color: var(--ae-oxblood); }
	.ae-mast__trade a:hover .ae-glyph, .ae-mast__trade a[aria-current] .ae-glyph { color: var(--ae-oxblood); transform: translateY(-1px); }
	.ae-mast__trade a:hover::after, .ae-mast__trade a[aria-current]::after { transform: scaleX(1); }
	.ae-mast__util { display: flex; align-items: center; gap: 1.25rem; justify-self: end; }
	.ae-mast__util-list { display: flex; gap: 1.1rem; margin: 0; padding: 0; list-style: none; }
	.ae-mast__util-list a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ae-linen); font-size: 0.875rem; text-decoration: none; }
	.ae-mast__util-list a:hover, .ae-mast__util-list a[aria-current] { color: var(--ae-brass-light); text-decoration: underline; }

	/* « Sommaire » panel */
	.ae-panel { position: absolute; left: 0; right: 0; top: 100%; z-index: 50; background: var(--ae-base); border-top: 1px solid var(--ae-line); border-bottom: 1px solid var(--ae-ink); box-shadow: 0 30px 50px -30px rgb(32 27 30 / 0.35); }
	.ae-panel[hidden] { display: none; }
	.ae-panel__inner { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 2fr) minmax(0, 0.85fr); gap: 2.5rem; padding-block: 2.25rem 2.5rem; }
	.ae-panel__links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; }
	.ae-panel__kicker { margin: 0 0 0.6rem; font-weight: 600; font-size: 0.875rem; color: var(--ae-brass-text); }
	.ae-panel__title { margin: 0; font-family: var(--ae-serif); font-weight: 600; font-size: 2rem; line-height: 1.05; letter-spacing: -0.015em; }
	.ae-panel__desc { margin: 0.9rem 0 1.25rem; color: var(--ae-taupe); font-size: 0.975rem; line-height: 1.6; }
	.ae-panel__entries { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2rem; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--ae-ink); align-content: start; }
	.ae-panel__entries li { border-bottom: 1px solid var(--ae-line); }
	.ae-panel__entries a { display: grid; grid-template-columns: 2.7rem 36px minmax(0, 1fr) auto; column-gap: 0.6rem; align-items: center; padding: 0.7rem 0; color: var(--ae-ink); text-decoration: none; }
	.ae-panel__no { font-size: 0.95rem; }
	.ae-panel__icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--ae-linen); color: var(--ae-blue); }
	.ae-panel__entry { font-family: var(--ae-serif); font-weight: 600; font-size: 1.15rem; line-height: 1.15; }
	.ae-panel__entries .ae-count { grid-column: 4; grid-row: 1; margin: 0; }
	.ae-panel__line { grid-column: 3 / -1; margin-top: 0.15rem; font-size: 0.84rem; line-height: 1.4; color: var(--ae-taupe); }
	.ae-panel__entries a:hover .ae-panel__icon { background: var(--ae-oxblood); color: var(--ae-linen); }
	.ae-panel__entries a:hover .ae-panel__entry { color: var(--ae-oxblood); }
	.ae-panel__empty { margin: 0; padding-top: 1rem; border-top: 1px solid var(--ae-ink); font-family: var(--ae-serif); font-style: italic; font-size: 1.4rem; line-height: 1.3; color: var(--ae-taupe); }
	.ae-panel__feature { display: block; color: var(--ae-ink); text-decoration: none; }
	.ae-panel__feature-kicker { display: block; margin-top: 0.9rem; font-weight: 600; font-size: 0.875rem; color: var(--ae-brass-text); }
	.ae-panel__feature-title { display: block; margin-top: 0.25rem; font-family: var(--ae-serif); font-size: 1.45rem; line-height: 1.12; }
	.ae-panel__feature:hover .ae-panel__feature-title { color: var(--ae-oxblood); }
	.ae-panel__feature--seal { display: grid; place-items: center; align-content: center; gap: 1rem; background: var(--ae-linen); border: 1px solid var(--ae-brass); padding: 1.5rem; color: var(--ae-ink); text-align: center; }
	.ae-panel__feature--seal p { margin: 0; font-family: var(--ae-serif); font-style: italic; font-size: 1.15rem; }
}

@media (min-width: 1440px) {
	.ae-mast__motto-more { display: inline; }
	.ae-mast__logo img { width: 230px; }
	.ae-mast__trade a { font-size: 0.9375rem; }
}

@media (min-width: 400px) and (max-width: 599px) {
	.ae-mast__logo img { width: 150px; }
}
