/* Shared layout, candidate-specific surfaces and contrast. */
body[data-tone] {
 --v3-surface:color-mix(in srgb,var(--highlight) 6%,#141216);
 --v3-menu:color-mix(in srgb,var(--highlight) 12%,#151218);
 --v3-selected:color-mix(in srgb,var(--highlight) 25%,#151218);
 --v3-macro-ink:#211a23;
 --v3-light-band:linear-gradient(to right,color-mix(in srgb,var(--solid) 55%,white),color-mix(in srgb,var(--highlight) 18%,white));
 --v3-light-ink:#211a23; --v3-light-muted:#49404a;
}
body[data-tone="red"] {
 --v3-surface:#20120f; --v3-menu:#2c1712; --v3-selected:#633027;
 --v3-macro-ink:#fff5ed; --v3-light-band:linear-gradient(to right,#f1ac91,#fff0df);
 --v3-light-ink:#42160f; --v3-light-muted:#613326;
}
/* V3 pilot: same dark-red identity; catalogue controls are scoped to Programme. */
#programme[data-programme-v3] > h2 { font-size:clamp(1.5rem,4.2vw,2.65rem); margin-bottom:5px; }
.v3-context { color:var(--muted); font-size:.875rem; margin-bottom:14px; }
.v3-controls { display:grid; grid-template-columns:1fr 1fr; gap:10px 14px; margin-bottom:8px; }
.v3-controls[hidden], #programme [hidden] { display:none!important; }
.v3-field { min-width:0; }
.v3-field > span,.v3-search { display:block; color:var(--muted); font-size:.875rem; }
.v3-picker { position:relative; margin-top:4px; }
.v3-picker-button,.v3-search input { width:100%; min-height:46px; font:inherit; font-size:1rem; border:1px solid var(--edge); border-radius:9px; background:var(--v3-surface); color:var(--ink); }
.v3-picker-button { display:flex; gap:10px; justify-content:space-between; align-items:center; text-align:left; padding:10px 12px; }
.v3-picker-button > span { min-width:0; overflow-wrap:anywhere; }
.v3-picker-button svg { width:18px; height:18px; flex-shrink:0; fill:none; stroke:var(--highlight); stroke-width:2; }
.v3-picker-button[aria-expanded="true"] { border-color:var(--highlight); }
.v3-picker-button[aria-expanded="true"] svg { transform:rotate(180deg); }
.v3-options { position:absolute; z-index:5; top:calc(100% + 5px); left:0; width:100%; min-width:0; max-height:50vh; overflow:auto; overscroll-behavior:contain; padding:5px; background:var(--v3-menu); border:1px solid var(--highlight); border-radius:9px; box-shadow:0 12px 35px #000a; }
.v3-options button { display:block; width:100%; border:0; border-radius:6px; padding:12px 10px; background:none; color:var(--ink); text-align:left; font-size:1rem; line-height:1.4; overflow-wrap:anywhere; }
.v3-options button[aria-selected="true"],.v3-options button:hover,.v3-options button:focus { background:var(--v3-selected); outline-offset:-2px; }
.v3-search { grid-column:1/-1; }
.v3-search input { display:block; padding:10px 12px; margin-top:4px; }
.v3-search input::placeholder { color:var(--muted); opacity:1; }
.v3-results { font-size:.875rem; color:var(--muted); margin:10px 0 14px; }
body[data-tone] #programme .v3-kind-heading { background:none; border:0; border-radius:0; color:var(--highlight); font-size:1.125rem; padding:0; margin:18px 0 10px; }
#programme .v3-theme { margin-bottom:10px; }
#programme .v3-theme > summary { min-height:44px; padding:5px 42px 5px 15px; gap:1px; }
#programme .v3-theme > summary > strong { font-size:1.0625rem; }
.v3-count { font-size:.8125rem; color:var(--muted); }
.v3-subthemes { display:grid; gap:8px; margin:0 10px 10px; }
#programme .v3-subtheme > summary { min-height:44px; padding:5px 39px 5px 12px; gap:1px; }
#programme :is(.v3-theme,.v3-subtheme) > summary::after { top:50%; transform:translateY(-50%); }
#programme .v3-subtheme > summary > strong { font-size:1rem; }
.v3-measures { display:grid; gap:8px; margin:0 8px 8px; }
#programme .v3-measure > summary { padding:12px 38px 12px 12px; }
#programme .v3-measure > summary strong { font-size:1rem; font-weight:650; }
#programme .v3-measure .detail { font-size:1rem; margin-inline:12px; line-height:1.65; }
.v3-sources { padding-left:1.15rem; margin:14px 0 0; }
.v3-sources li + li { margin-top:10px; }
.v3-sources span { display:block; color:var(--muted); font-size:.875rem; }
.v3-empty,.v3-no-results { color:var(--muted); font-size:1rem; }
.v3-method { margin-top:20px; }
#programme .v3-method > summary { font-size:.875rem; }
.v3-method p + p { margin-top:12px; }
@media(max-width:540px) {
 .v3-controls { grid-template-columns:1fr; gap:10px; }
 .v3-search { grid-column:auto; }
 #programme[data-programme-v3] > h2 { padding:10px 12px; letter-spacing:-.035em; }
 .v3-subthemes { margin-inline:6px; }
 .v3-measures { margin-inline:5px; }
}

/* Requested hierarchy: macro theme, light section bar, indented dark subsection. */
.v3-controls { position:relative; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; align-items:start; }
.v3-search { grid-column:auto; min-width:0; }
.v3-picker { position:static; }
.v3-picker-button { height:46px; min-height:46px; padding:10px; gap:5px; }
.v3-picker-button > span { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.v3-options { top:calc(100% + 5px); left:0; right:0; width:auto; }
.v3-macro { margin:24px 0; }
body[data-tone] #programme details.v3-macro,
body[data-tone] #programme details.v3-macro[open] {
 background:none; border:0; box-shadow:none; backdrop-filter:none;
}
#programme .v3-macro > summary {
 display:flex; align-items:center; gap:12px; margin:0; padding:12px 48px 12px 15px;
 background:var(--secondary-band-background,linear-gradient(to right,#94251f,#3e110e));
 border:1px solid var(--edge); border-inline-start:3px solid var(--highlight); border-radius:12px;
 color:var(--v3-macro-ink); font-family:var(--display); font-weight:800;
 font-size:clamp(1.16rem,2.5vw,1.5rem); line-height:1.15; letter-spacing:.005em;
}
.v3-macro > summary > h4 { margin:0; font:inherit; color:inherit; letter-spacing:inherit; }
#programme .v3-macro > summary::after { top:50%; transform:translateY(-50%); color:var(--v3-macro-ink); background:#ffffff30; }
.v3-macro-content { padding:18px 6px 0 24px; }
#programme .v3-macro-content > .v3-theme { margin-bottom:16px; }
#programme .v3-subthemes,.v3-measures { gap:12px; }
.v3-macro-icon { flex:0 0 28px; width:28px; height:28px; fill:none; stroke:currentColor; stroke-width:1.65; stroke-linecap:round; stroke-linejoin:round; }
.v3-option-group { display:flex; align-items:center; gap:9px; margin:12px 7px 5px; padding-top:10px; border-top:1px solid var(--edge); color:var(--highlight); font-size:.875rem; font-weight:700; }
.v3-option-group .v3-macro-icon { width:20px; height:20px; flex-basis:20px; }
body[data-tone] #programme .v3-theme > summary { background:var(--v3-light-band); color:var(--v3-light-ink); border-radius:12px; }
body[data-tone] #programme .v3-theme > summary > strong { color:var(--v3-light-ink); }
#programme .v3-theme > summary .v3-count { color:var(--v3-light-muted); }
body[data-tone] #programme .v3-theme > summary::after { color:var(--v3-light-ink); background:#ffffff80; }
.v3-subthemes { margin:12px 10px 12px 28px; }
body[data-tone] #programme .v3-subtheme > summary { background:var(--card-surface,var(--v3-surface)); border-radius:12px; }
#programme .v3-subtheme > summary > strong {
 font-family:var(--mono,"JetBrains Mono",monospace); font-size:.875rem; line-height:1.5;
 font-weight:800; color:var(--highlight); text-transform:uppercase; letter-spacing:.06em;
}
body[data-tone] #programme .v3-subtheme > summary::after { color:var(--highlight); background:var(--v3-selected); }
@media(max-width:540px) {
 .v3-controls { grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
 .v3-field > span,.v3-search { font-size:.8125rem; white-space:nowrap; }
 .v3-picker-button { padding:8px; }
 .v3-search input { padding:8px; }
 .v3-picker-button svg { flex-basis:14px; width:14px; height:14px; }
 .v3-subthemes { margin-left:16px; margin-right:6px; }
 #programme .v3-macro > summary { gap:10px; padding:12px 42px 12px 12px; }
}

/* Same candidate reminder as Votes, above the Programme title. */
:is(#programme,#justice,#sondages) .votes-candidate { display:flex; gap:20px; align-items:center; margin:18px 0 28px; }
:is(#programme,#justice,#sondages) .votes-candidate img { display:block; width:88px; height:96px; object-fit:cover; object-position:center 30%; border-radius:12px; border:1px solid var(--line); }
:is(#programme,#justice,#sondages) .votes-candidate-label { color:var(--muted); font-size:.85rem; }
:is(#programme,#justice,#sondages) .votes-candidate h1 { font:800 clamp(1.7rem,4vw,2.6rem)/1.2 Inter,system-ui,sans-serif; letter-spacing:-.035em; color:var(--ink); margin:5px 0 7px; }
:is(#programme,#justice,#sondages) .votes-candidate p { font-size:1rem; color:var(--highlight); font-weight:650; }
@media(max-width:600px) {
 :is(#programme,#justice,#sondages) .votes-candidate { gap:13px; margin:16px 0 22px; }
 :is(#programme,#justice,#sondages) .votes-candidate img { width:65px; height:78px; border-radius:9px; }
 :is(#programme,#justice,#sondages) .votes-candidate h1 { font-size:1.6rem; }
 :is(#programme,#justice,#sondages) .votes-candidate-label { font-size:.8rem; }
 :is(#programme,#justice,#sondages) .votes-candidate p { font-size:.95rem; }
}

/* Keep the validated plus/minus affordance in every candidate palette. */
#programme :is(.v3-macro,.v3-theme,.v3-subtheme,.v3-measure) > summary::after {
 content:"+"; border:0; width:24px; height:24px; line-height:24px; padding:0;
 display:block; text-align:center; font-weight:800; border-radius:50%;
 top:50%; right:11px; transform:translateY(-50%);
}
#programme :is(.v3-macro,.v3-theme,.v3-subtheme,.v3-measure)[open] > summary::after { content:"−"; }
