/* ==========================================================================
   Prénoms dans les œuvres (design "Corail", variables de theme/css/pages.css)
   - Accueil : templates/oeuvres.tpl (onglets par univers : theme/js/oeuvres.js)
   - Page d'une œuvre : templates/oeuvres_page.tpl (filtres, tri et votes : theme/js/oeuvres.js)
   - Encadré de la fiche prénom : templates/includes/oeuvres_fiche.tpl
   Les tuiles colorées des œuvres (.ovt) et le menu sont dans theme/css/layout.css (chargé partout).
   --ov-c = couleur de l'œuvre (BO), --ov-ink = texte posé dessus (ovInk), posés en style sur chaque élément qui en change.
   Chargé par templates/includes/header.tpl sur ces pages et sur les fiches qui ont un personnage.
   ========================================================================== */

.ovf-i{ --ov-d:#2b2421; }
@supports (color:color-mix(in oklab, red, blue)){
	.ovf-i{ --ov-d:color-mix(in oklab, var(--ov-c) 62%, #000); }
}

.pg .ov-h2{ font-size:clamp(22px,2.6vw,28px); letter-spacing:-.03em; line-height:1.1; }
.ov-sec{ margin-top:48px; }

/* Médailles du top 5 (accueil et page d'une œuvre) */
.ov-medal{ flex:none; width:44px; height:44px; border-radius:50%; display:grid; place-items:center; background:var(--pg-field); color:var(--pg-muted);
	font-family:'Bricolage Grotesque',sans-serif; font-weight:800; font-size:19px; line-height:1; box-shadow:inset 0 -3px 0 rgba(0,0,0,.08); }
.ov-medal-1, .ov-medal-2, .ov-medal-3{ color:#fff; box-shadow:inset 0 -3px 0 rgba(0,0,0,.15); }
.ov-medal-1{ background:#d9a326; }
.ov-medal-2{ background:#a8a29c; }
.ov-medal-3{ background:#b8743d; }

/* ---------- Accueil ---------- */
.ov-head{ margin:14px 0 24px; }
.pg .ov-head .pg-h1{ font-size:clamp(34px,5vw,56px); }
.pg .ov-head-d{ margin-top:10px; max-width:700px; font-size:16.5px; line-height:1.55; color:var(--pg-text2); text-wrap:pretty; }

/* Top 5 des personnages préférés, toutes œuvres confondues */
.ov-t5-w{ margin-bottom:32px; }
.ov-t5-head{ display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:4px 16px; margin-bottom:14px; }
.pg .ov-t5-head p{ font-size:14px; color:var(--pg-muted); }
.ov-t5{ display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; }
.ov-t5 a{ height:100%; display:grid; grid-template-columns:auto minmax(0,1fr); grid-template-rows:auto auto auto; align-items:center; gap:0 12px;
	padding:14px 16px 14px 14px; background:#fff; border:1px solid var(--pg-line); border-radius:20px; transition:border-color .15s, box-shadow .15s; }
.pg .ov-t5 a:hover{ border-color:var(--pg-tint-bd); box-shadow:var(--pg-shadow); }
.ov-t5 .ov-medal{ grid-row:1 / 4; width:36px; height:36px; font-size:16px; }
.ov-t5-t{ grid-row:1 / 3; display:flex; flex-direction:column; gap:2px; min-width:0; }
.ov-t5-t strong{ font-family:'Bricolage Grotesque',sans-serif; font-weight:800; font-size:21px; letter-spacing:-.03em; line-height:1.1; overflow-wrap:anywhere; }
.ov-t5-t span{ display:flex; align-items:center; gap:6px; font-size:12.5px; color:var(--pg-muted); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.ov-t5-t span::before{ content:''; flex:none; width:8px; height:8px; border-radius:50%; background:var(--ov-c); }
.ov-t5-v{ grid-column:2; font-size:12.5px; font-weight:700; color:var(--pg-ink); font-variant-numeric:tabular-nums; }

/* Onglets par univers + grille des tuiles */
.ov-tabs{ display:flex; flex-wrap:wrap; gap:6px; margin-bottom:20px; }
.ov-tabs[hidden]{ display:none; }
.ovt-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,270px),1fr)); gap:12px; }
.ovt-grid > li{ display:flex; min-width:0; }
.ovt-grid > li[hidden]{ display:none; }
.ovt-grid > li > .ovt{ flex:1; }
.ovt-grid-sm{ grid-template-columns:repeat(auto-fill,minmax(min(100%,220px),1fr)); gap:10px; }

/* Les plus donnés */
.ov-most{ display:flex; flex-direction:column; gap:2px; background:#fff; border:1px solid var(--pg-line); border-radius:24px; padding:10px 18px; }
.ov-most li{ display:grid; grid-template-columns:minmax(90px,150px) minmax(0,1fr) minmax(80px,220px) 72px; align-items:center; gap:14px; padding:9px 0; border-top:1px solid var(--pg-line3); }
.ov-most li:first-child{ border-top:0; }
.ov-most-n{ display:inline-flex; align-items:center; gap:7px; font-weight:700; font-size:15.5px; }
.ov-most-n::before{ content:''; flex:none; width:8px; height:8px; border-radius:50%; background:var(--pg-x); }
.ov-most-n.ov-chip-f::before{ background:var(--pg-f); }
.ov-most-n.ov-chip-m::before{ background:var(--pg-m); }
.pg .ov-most-n:hover{ color:var(--pg-coral-d); }
.ov-most-w{ font-size:13px; color:var(--pg-muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ov-most-bar{ height:8px; border-radius:999px; background:var(--pg-field); overflow:hidden; }
.ov-most-bar span{ display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#f2a33a,var(--pg-coral)); }
.ov-most-v{ text-align:right; font-weight:700; font-size:14px; font-variant-numeric:tabular-nums; }

/* ---------- Page d'une œuvre : bandeau à la couleur de l'œuvre ---------- */
.ov-hero{ position:relative; overflow:hidden; margin-top:14px; padding:clamp(22px,4vw,44px); border-radius:32px;
	background:var(--ov-c) center/cover no-repeat; color:var(--ov-ink); }
.ov-hero.has-img::before{ content:''; position:absolute; inset:0; background:var(--ov-c); opacity:.84; }
.ov-hero-g{ position:absolute; right:clamp(-20px,2vw,40px); bottom:-44px; opacity:.12; pointer-events:none; }
.ov-hero-g svg{ display:block; width:auto; height:clamp(150px,21vw,260px); overflow:visible; }
.ov-hero-g .gm-ill-line{ fill:none; stroke:currentColor; stroke-width:5; stroke-linecap:round; stroke-linejoin:round; }
.ov-hero-g :is(.gm-ill-coral, .gm-ill-ink, .gm-ill-fill, .gm-ill-dot){ fill:currentColor; stroke:none; }
.ov-hero-t{ position:relative; max-width:720px; }
.pg .ov-kicker{ font-size:12px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; opacity:.8; }
.pg .ov-h1{ margin:8px 0 10px; font-size:clamp(34px,5vw,56px); letter-spacing:-.035em; line-height:1.02; color:inherit; text-wrap:balance; }
.pg .ov-lead{ font-size:16.5px; line-height:1.55; opacity:.92; text-wrap:pretty; }
.ov-hero-meta{ display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-top:22px; }
.pg .ov-pill{ display:inline-flex; align-items:center; border:1px solid rgba(255,255,255,.25); border-radius:999px; padding:8px 14px;
	background:rgba(255,255,255,.16); color:inherit; font-weight:600; font-size:13.5px; line-height:1.2; }
.pg .ov-share{ cursor:pointer; }
.pg .ov-share:hover{ background:rgba(255,255,255,.28); }

/* Message après un vote */
.pg .ov-toast{ position:fixed; z-index:80; left:50%; bottom:20px; transform:translateX(-50%); width:max-content; max-width:min(92vw,520px); margin:0;
	box-shadow:0 18px 40px -16px rgba(40,20,10,.45); }
.ov-toast[hidden]{ display:none; }

/* ---------- Top 5 des votes : podium 4 · 2 · 1 · 3 · 5 ---------- */
.ov-top-w{ margin-top:40px; }
.ov-top-head{ display:flex; flex-direction:column; align-items:center; gap:6px; text-align:center; }
.pg .ov-top-head p{ max-width:680px; font-size:13.5px; color:var(--pg-muted); }
.pg .ov-top{ display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0,176px); justify-content:center; align-items:end; gap:10px; margin:18px 0 0; }
.ov-top[hidden], .ov-top-empty[hidden]{ display:none; }
.ov-top-i{ display:flex; flex-direction:column; align-items:center; gap:10px; min-width:0; }
.ov-top-1{ order:3; }
.ov-top-2{ order:2; }
.ov-top-3{ order:4; }
.ov-top-4{ order:1; }
.ov-top-5{ order:5; }
.pg .ov-top-n{ max-width:100%; font-family:'Bricolage Grotesque',sans-serif; font-weight:800; font-size:clamp(18px,2.2vw,26px); letter-spacing:-.03em; line-height:1.1;
	text-align:center; overflow-wrap:anywhere; }
.pg .ov-top-n:hover{ color:var(--pg-coral-d); }
.ov-top-bar{ width:100%; height:80px; display:flex; flex-direction:column; align-items:center; padding-top:14px; border-radius:18px 18px 6px 6px;
	background:var(--pg-field); color:var(--pg-ink); }
.ov-top-1 .ov-top-bar{ height:190px; background:var(--ov-c); color:var(--ov-ink); }
.ov-top-2 .ov-top-bar{ height:150px; }
.ov-top-3 .ov-top-bar{ height:120px; }
.ov-top-4 .ov-top-bar{ height:96px; }
.ov-top-bar b{ font-family:'Bricolage Grotesque',sans-serif; font-weight:800; font-size:24px; letter-spacing:-.02em; line-height:1.2; font-variant-numeric:tabular-nums; }
.ov-top-bar span{ font-size:12.5px; font-weight:600; opacity:.85; }
.pg .ov-top-empty, .pg .ov-none{ max-width:760px; margin:18px auto 0; border:1.5px dashed var(--pg-dash); border-radius:22px; padding:30px 24px; text-align:center; color:var(--pg-muted); }

/* ---------- Personnages : filtres ---------- */
.ov-list-head{ display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; margin-bottom:16px; }
.ov-tools{ display:flex; flex-wrap:wrap; align-items:center; gap:10px; }
.ov-tools[hidden]{ display:none; }
.pg .ov-seg .pg-seg-i{ padding:8px 14px; font-weight:600; font-size:13.5px; }
.pg .ov-switch{ display:inline-flex; align-items:center; gap:10px; border:1px solid var(--pg-line2); border-radius:999px; padding:6px 14px 6px 6px; background:#fff;
	font-weight:600; font-size:13.5px; color:var(--pg-ink); }
.pg .ov-switch[aria-pressed="true"]{ border-color:var(--pg-coral); background:var(--pg-tint); }
.ov-switch-k{ position:relative; flex:none; width:36px; height:22px; border-radius:999px; background:#d9cec8; transition:background .2s; }
.ov-switch-k::after{ content:''; position:absolute; top:3px; left:3px; width:16px; height:16px; border-radius:50%; background:#fff; transition:left .2s; }
.ov-switch[aria-pressed="true"] .ov-switch-k{ background:var(--pg-coral); }
.ov-switch[aria-pressed="true"] .ov-switch-k::after{ left:17px; }

/* ---------- Cartes des personnages ---------- */
.ov-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,300px),1fr)); gap:12px; }
.ov-card{ display:flex; flex-direction:column; gap:12px; min-width:0; padding:20px; background:#fff; border:1.5px solid var(--pg-line); border-radius:24px;
	scroll-margin-top:90px; transition:border-color .2s; }
.ov-card[hidden]{ display:none; }
.ov-card.is-mine{ border-color:var(--pg-coral); }
.ov-card:target{ animation:ov-flash 1.6s ease-out; }
@keyframes ov-flash{ from{ box-shadow:0 0 0 6px var(--pg-tint-bd); } }
.ov-card-h{ display:flex; justify-content:space-between; align-items:flex-start; gap:10px; }
.ov-card-id{ min-width:0; }
.ov-card-n{ display:flex; align-items:center; gap:10px; }
.ov-sx{ flex:none; width:28px; height:28px; border-radius:50%; display:grid; place-items:center; background:var(--pg-x); color:#fff; font-size:13px; line-height:1; }
.ov-sx-f .ov-sx{ background:var(--pg-f); }
.ov-sx-m .ov-sx{ background:var(--pg-m); }
.ov-av{ flex:none; width:44px; height:44px; border-radius:50%; overflow:hidden; display:grid; place-items:center; background:var(--pg-field); }
.ov-av img{ width:100%; height:100%; object-fit:cover; }
.pg .ov-name{ font-size:28px; letter-spacing:-.035em; line-height:1; overflow-wrap:anywhere; }
.pg .ov-role{ margin-top:6px; font-size:13px; line-height:1.4; color:var(--pg-muted); }
.ov-rank{ flex:none; font-size:12px; font-weight:800; color:var(--pg-muted); font-variant-numeric:tabular-nums; }
.pg .ov-com{ font-size:14.5px; line-height:1.5; color:#4a403b; text-wrap:pretty; }

.ov-stat{ display:flex; flex-direction:column; gap:6px; border-radius:14px; padding:10px 12px; background:var(--pg-paper); }
.ov-spark{ display:block; width:100%; height:30px; overflow:visible; }
.ov-spark-a{ fill:rgba(232,96,79,.14); }
.ov-spark-l{ fill:none; stroke:var(--pg-coral); stroke-width:1.6px; stroke-linejoin:round; }
.ov-spark-m{ stroke:var(--pg-coral-dd); stroke-width:1px; stroke-dasharray:3 3; opacity:.45; }
.ov-stat.is-none .ov-spark-a{ display:none; }
.ov-stat.is-none .ov-spark-l{ stroke:#d9cec8; }
.pg .ov-stat-r{ display:flex; justify-content:space-between; align-items:baseline; gap:8px; font-size:11px; line-height:1.35; color:var(--pg-muted); }
.ov-stat-r b{ flex:1; text-align:center; font-weight:700; color:var(--pg-ink); }
.ov-stat.is-none .ov-stat-r b{ color:#b0701c; }

.ov-card-act{ display:flex; align-items:center; gap:8px; margin-top:auto; }
.ov-vote-f{ flex:1; display:flex; margin:0; }
.pg .ov-vote{ flex:1; display:flex; align-items:center; justify-content:center; gap:8px; height:44px; border:1.5px solid var(--pg-tint-bd); border-radius:14px;
	background:#fff; color:var(--pg-coral-d); font-weight:700; font-size:14px; white-space:nowrap; transition:background .15s, color .15s, border-color .15s; }
.pg .ov-vote:hover{ background:var(--pg-tint); }
.pg .ov-vote[aria-pressed="true"]{ border-color:var(--pg-coral); background:var(--pg-coral); color:#fff; }
.ov-heart{ font-size:16px; line-height:1; }
.is-busy .ov-vote{ opacity:.55; pointer-events:none; }
.pg .ov-fiche{ flex:none; display:inline-flex; align-items:center; height:44px; padding:0 14px; border:1px solid var(--pg-line2); border-radius:14px; background:#fff;
	color:var(--pg-ink); font-weight:600; font-size:13.5px; white-space:nowrap; }
.pg .ov-fiche:hover{ border-color:var(--pg-ink); color:var(--pg-ink); }
.ov-res{ display:flex; align-items:center; gap:8px; font-size:12px; color:var(--pg-muted); }
.ov-bar{ flex:1; height:5px; border-radius:999px; background:var(--pg-field); overflow:hidden; }
.ov-bar > span{ display:block; height:100%; border-radius:inherit; background:var(--pg-coral); transition:width .45s ease; }
.is-never .ov-bar > span{ background:#d9cec8; }
.ov-res-v{ font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap; }

/* ---------- Fiche prénom : « Dans les œuvres » ---------- */
.ovf{ display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr)); gap:14px; }
.ovf-i{ display:flex; flex-direction:column; min-width:0; background:#fff; border:1px solid var(--pg-line); border-radius:22px; overflow:hidden; }
.ovf-top{ display:flex; align-items:center; gap:12px; padding:12px 16px; background:linear-gradient(135deg, var(--ov-c), var(--ov-d)); color:#fff; }
.pg a.ovf-top, .pg a.ovf-top:hover{ color:#fff; }
.ovf-emb svg{ display:block; width:auto; height:30px; overflow:visible; }
.ovf-emb .gm-ill-line{ fill:none; stroke:#fff; stroke-width:4; stroke-linecap:round; stroke-linejoin:round; }
.ovf-emb .gm-ill-fill{ fill:rgba(255,255,255,.22); }
.ovf-emb .gm-ill-ink{ fill:rgba(255,255,255,.55); }
.ovf-emb .gm-ill-coral{ fill:#fff; }
.ovf-emb .gm-ill-dot{ fill:var(--ov-c); stroke:#fff; stroke-width:3; }
.ovf-w{ font-family:'Bricolage Grotesque',sans-serif; font-weight:800; font-size:17px; line-height:1.2; }
.ovf-b{ display:flex; flex-direction:column; gap:8px; padding:14px 16px 16px; }
.pg .ovf-n{ font-size:14px; color:var(--pg-muted); }
.ovf-n strong{ display:block; font-size:16px; color:var(--pg-ink); }
.pg .ovf-c{ font-size:14.5px; line-height:1.55; }
.ovf-b .pg-link{ margin-top:auto; }

/* ---------- Tablette, mobile ---------- */
@media (max-width:1100px){
	.ov-t5{ grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr)); }
}
@media (max-width:820px){
	.ov-most li{ grid-template-columns:minmax(0,1fr) auto; gap:4px 12px; }
	.ov-most-w{ grid-column:1; grid-row:2; }
	.ov-most-bar{ grid-column:1 / -1; grid-row:3; }
	.ov-most-v{ grid-column:2; grid-row:1; }
}
@media (max-width:640px){
	.ov-hero{ border-radius:26px; }
	/* Top 5 de l'accueil : une ligne par personnage, votes à droite */
	.ov-t5{ grid-template-columns:minmax(0,1fr); gap:8px; }
	.ov-t5 a{ grid-template-columns:auto minmax(0,1fr) auto; grid-template-rows:auto; padding:10px 14px 10px 10px; }
	.ov-t5 .ov-medal, .ov-t5-t{ grid-row:1; }
	.ov-t5-t strong{ font-size:19px; }
	.ov-t5-v{ grid-column:3; grid-row:1; }
	/* Top 5 d'une œuvre : podium des 3 premiers, 4e et 5e en lignes dessous */
	.pg .ov-top{ grid-auto-flow:row; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
	.ov-top-1{ grid-column:2; grid-row:1; }
	.ov-top-2{ grid-column:1; grid-row:1; }
	.ov-top-3{ grid-column:3; grid-row:1; }
	.pg .ov-top-n{ font-size:17px; }
	.ov-top-1 .ov-top-bar{ height:150px; }
	.ov-top-2 .ov-top-bar{ height:118px; }
	.ov-top-3 .ov-top-bar{ height:96px; }
	.ov-top-bar b{ font-size:20px; }
	.ov-top-4, .ov-top-5{ grid-column:1 / -1; flex-direction:row; gap:12px; padding:8px 14px 8px 8px; border:1px solid var(--pg-line); border-radius:16px; background:#fff; }
	.ov-top-4 .ov-medal, .ov-top-5 .ov-medal{ width:34px; height:34px; font-size:15px; }
	.pg :is(.ov-top-4, .ov-top-5) .ov-top-n{ flex:1; text-align:left; font-size:18px; }
	:is(.ov-top-4, .ov-top-5) .ov-top-bar{ width:auto; height:auto; flex-direction:row; align-items:baseline; gap:8px; padding:0; background:none; }
	:is(.ov-top-4, .ov-top-5) .ov-top-bar b{ font-size:17px; }
	.ov-card{ padding:18px 16px; }
	.pg .ov-name{ font-size:25px; }
}
@media (prefers-reduced-motion:reduce){
	.ov-card, .ov-vote, .ov-bar > span, .ov-switch-k, .ov-switch-k::after, .ov-t5 a{ transition:none; }
	.ov-card:target{ animation:none; }
}
