/* Catalogue-only adjustments; KiwiPedia owns shared geometry, motion and responsive rules. */

.factions-list-page .pedia-categories{flex-wrap:wrap}

/* One shared scene: neutral overview and a single synchronized active character. */
.faction-showcase{--fs-stage-height:clamp(480px,66vw,760px);min-height:var(--fs-stage-height);--fs-accent:var(--green,#9aff56);position:relative;isolation:isolate;overflow:hidden;background:var(--bg-main,#050907);padding:0 0 28px}
.faction-showcase .fs-background{position:absolute;inset:0;z-index:-1;overflow:hidden;pointer-events:none;background:radial-gradient(ellipse at center,#273229,#071009)}
.faction-showcase .fs-background img{width:100%;height:100%;object-fit:cover;opacity:.86;filter:brightness(1);transform:scale(1);transform-origin:center;transition:filter 550ms cubic-bezier(.22,.61,.36,1),transform 550ms cubic-bezier(.22,.61,.36,1)}
.faction-showcase.has-character-hover .fs-background img{filter:brightness(.9);transform:scale(1.02)}
.faction-showcase .fs-background::after{content:'';position:absolute;inset:0;pointer-events:none;background:linear-gradient(90deg,var(--bg-main,#050907),transparent 15%,transparent 85%,var(--bg-main,#050907)),linear-gradient(180deg,var(--bg-main,#050907),transparent 14%,transparent 58%,var(--bg-main,#050907) 100%)}
.faction-showcase .fs-stage::after{content:'';position:absolute;z-index:3;inset:76% 0 0;pointer-events:none;background:linear-gradient(transparent,#03050388 80%,#030503)}

.faction-showcase .fs-stage{position:relative;display:flex;align-items:stretch;width:100%;height:var(--fs-stage-height);min-height:var(--fs-stage-height);flex:none;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x proximity;scrollbar-width:thin;scrollbar-color:#4b5c4e transparent}
.faction-showcase .fs-portrait{position:relative;isolation:isolate;overflow:visible;filter:drop-shadow(0 4px 8px #0004);transition:filter 200ms ease-out;flex:1 0 25%;min-width:200px;height:100%;margin:0;padding:0;border:0;border-radius:0;background:transparent;cursor:pointer;scroll-snap-align:center}
.faction-showcase .fs-portrait img{position:absolute;left:50%;top:calc(96% - var(--fs-body-height,81.4%) - var(--fs-body-height,81.4%) * var(--fs-alpha-top,0) / var(--fs-alpha-height,1));width:auto;max-width:none;height:calc(var(--fs-body-height,81.4%) / var(--fs-alpha-height,1));object-fit:contain;filter:brightness(.94) saturate(.9) contrast(.98);transform:translateX(calc(-100% * var(--fs-alpha-center,.5))) scale(var(--fs-portrait-scale,1));transform-origin:calc(100% * var(--fs-alpha-center,.5)) calc(100% * var(--fs-alpha-bottom,1));transition:filter 300ms ease,transform 300ms cubic-bezier(.2,.65,.2,1);pointer-events:none;mask-image:linear-gradient(180deg,#000 82%,transparent 100%)}
.faction-showcase .fs-portrait:not(.has-portrait){display:none}
.faction-showcase .fs-missing-portraits{display:none;position:absolute;inset:20% 16px auto;margin:0;text-align:center;color:#85968a;font-size:12px;line-height:1.6;pointer-events:none}
.faction-showcase .fs-stage:not(:has(.has-portrait)) .fs-missing-portraits{display:block}

.faction-showcase.has-selection .fs-portrait:not(.is-selected) img{filter:brightness(.38) saturate(.65)}
.faction-showcase .fs-portrait.is-selected{z-index:2}
/* Filter the transparent parent AFTER the child's bottom mask, so the halo can leave the image canvas. */
.faction-showcase .fs-portrait.is-glowing{transition:filter 120ms cubic-bezier(.16,1,.3,1) 0ms;filter:drop-shadow(0 0 10px color-mix(in srgb,var(--faction-showcase-accent,var(--fs-accent)) 38%,transparent)) drop-shadow(0 0 22px color-mix(in srgb,var(--faction-showcase-accent,var(--fs-accent)) 18%,transparent))}
.faction-showcase .fs-portrait.is-selected img{--fs-portrait-scale:1.045;filter:brightness(1.05) saturate(.95)}
.faction-showcase .fs-portrait:focus-visible{outline:2px solid var(--faction-showcase-accent,var(--fs-accent));outline-offset:-5px}
.faction-showcase .fs-details{position:relative;z-index:3;display:grid;width:min(1000px,92%);margin:clamp(-210px,-17vw,-100px) auto 0;text-align:center;pointer-events:none;min-height:158px}
.faction-showcase .fs-detail,.faction-showcase .fs-neutral{grid-area:1/1;min-width:0;align-self:center}
.faction-showcase .fs-detail{opacity:1;transform:none;visibility:visible;transition:opacity 320ms ease,transform 320ms ease,visibility 0s}
.faction-showcase .fs-detail[hidden]{display:block!important;opacity:0;transform:translateY(8px);visibility:hidden;transition:opacity 320ms ease,transform 320ms ease,visibility 0s 320ms}
.faction-showcase .fs-neutral{align-self:end;padding-bottom:16px;font:700 12px/1.6 monospace;letter-spacing:.3em;color:#d4ddd6;transition:opacity 320ms}
.faction-showcase.has-selection .fs-neutral{opacity:0;visibility:hidden}
.faction-showcase .fs-detail h3{margin:0;color:#fff;font-size:clamp(48px,8.5vw,108px);font-weight:900;font-style:italic;line-height:1;letter-spacing:-.065em;overflow-wrap:anywhere;text-shadow:0 2px 12px #0008,0 0 10px color-mix(in srgb,var(--faction-showcase-accent,var(--fs-accent)) 48%,transparent),0 0 24px color-mix(in srgb,var(--faction-showcase-accent,var(--fs-accent)) 24%,transparent)}
.faction-showcase .fs-accent{display:block;width:34px;height:2px;margin:18px auto 12px;background:var(--faction-showcase-accent,var(--fs-accent))}
.faction-showcase .fs-full-name{margin:0 auto;color:#e6e9e6;font-size:clamp(12px,1.65vw,20px);font-weight:700;line-height:1.6;letter-spacing:.22em;text-transform:uppercase;overflow-wrap:anywhere;text-wrap:balance}
.faction-showcase .fs-description{max-width:640px;margin:8px auto 0;color:#a6b2a9;font-size:11px;line-height:1.6;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.faction-showcase .fs-reputations{display:none}
.faction-showcase .fs-hint{position:relative;z-index:3;margin:14px 10px 10px;text-align:center;color:#a7b6ac;font:700 9px/1.6 monospace;letter-spacing:.19em}
.faction-showcase .fs-hint::before{content:'↟';color:var(--faction-showcase-accent,var(--fs-accent));font-size:15px;margin-right:10px}
.faction-showcase .fs-badges{position:relative;z-index:3;display:flex;justify-content:safe center;gap:8px;max-width:100%;overflow-x:auto;padding:4px 16px 12px;scrollbar-width:thin}
.faction-showcase .fs-badge{flex:0 0 auto;display:flex;align-items:center;gap:8px;min-height:44px;max-width:260px;border:1px solid #ffffff1c;border-radius:99px;padding:4px 14px 4px 4px;background:#080c09dd;color:#c2c9c3;font:750 12px/1.4 Inter,sans-serif;cursor:pointer;transition:border-color 320ms,background 320ms,box-shadow 320ms,color 320ms}
.faction-showcase .fs-badge>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.faction-showcase .fs-badge-photo{position:relative;display:block;flex:none;width:34px;height:34px;overflow:hidden;border-radius:50%;background:#1a241d;border:2px solid var(--faction-showcase-accent,var(--fs-accent));box-shadow:0 0 5px color-mix(in srgb,var(--faction-showcase-accent,var(--fs-accent)) 25%,transparent);transition:border-color 300ms ease,box-shadow 300ms ease}
.faction-showcase .fs-badge-photo img{width:100%;height:100%;object-fit:cover}
.faction-showcase .fs-badge.is-selected{color:#fff;border-color:var(--faction-showcase-accent,var(--fs-accent));background:color-mix(in srgb,var(--faction-showcase-accent,var(--fs-accent)) 10%,#080c09);box-shadow:0 0 5px color-mix(in srgb,var(--faction-showcase-accent,var(--fs-accent)) 45%,transparent),0 4px 18px color-mix(in srgb,var(--faction-showcase-accent,var(--fs-accent)) 22%,transparent)}
.faction-showcase .fs-badge.is-selected .fs-badge-photo{border-color:var(--faction-showcase-accent,var(--fs-accent));box-shadow:0 0 4px color-mix(in srgb,var(--faction-showcase-accent,var(--fs-accent)) 70%,transparent),0 0 12px color-mix(in srgb,var(--faction-showcase-accent,var(--fs-accent)) 40%,transparent)}
@media(max-width:1000px) and (min-width:701px){.faction-showcase .fs-portrait{flex-basis:33.333%}}
@media(max-width:700px){.faction-showcase{--fs-stage-height:430px}.faction-showcase .fs-stage{height:var(--fs-stage-height);min-height:var(--fs-stage-height)}.faction-showcase .fs-portrait{flex:1 0 100%;min-width:0}.faction-showcase.has-selection .fs-portrait{display:none}.faction-showcase.has-selection .fs-portrait.is-selected.has-portrait{display:block;flex-basis:100%;min-width:0}.faction-showcase.has-selection .fs-stage{overflow:hidden}.faction-showcase .fs-portrait img{max-width:none}.faction-showcase .fs-details{margin-top:-140px;min-height:160px}.faction-showcase .fs-detail h3{font-size:clamp(38px,12vw,70px)}.faction-showcase .fs-full-name{font-size:12px;letter-spacing:.15em}.faction-showcase .fs-badges{justify-content:flex-start}.faction-showcase .fs-neutral{font-size:10px}}
@media(max-width:700px){.faction-showcase.has-selection:not(:has(.fs-portrait.is-selected.has-portrait)) .fs-missing-portraits{display:block}}
@media(prefers-reduced-motion:reduce){.faction-showcase *{transition:none!important;animation:none!important;scroll-behavior:auto!important}}

@media(prefers-reduced-motion:reduce){.faction-showcase .fs-portrait img{--fs-portrait-scale:1!important}}

/* Desktop-only cinematic breakout. Heading/filter container and mobile geometry are unchanged. */
@media(min-width:1001px){
 .pedia-page--archive.factions-list-page>.pedia-archive{width:94vw;max-width:none}
 .factions-list-page .faction-showcase{--fs-stage-height:clamp(400px,calc(49.9375vw - 30px),680px);position:relative;left:auto;width:100%;max-width:none;transform:none}
 .factions-list-page .faction-showcase .fs-stage{height:var(--fs-stage-height);min-height:var(--fs-stage-height);overflow:clip;scroll-snap-type:none;padding-inline:clamp(20px,4vw,80px);box-sizing:border-box}
 .factions-list-page .faction-showcase .fs-portrait{position:absolute;left:var(--fs-slot-center,50%);top:0;width:var(--fs-slot-width,clamp(120px,16vw,220px));height:100%;transform:translateX(-50%);flex:none;min-width:0}
 .factions-list-page .faction-showcase .fs-background img{object-position:center 46%}
 .factions-list-page .faction-showcase .fs-portrait img{top:calc(96% - var(--fs-body-height,78%) - var(--fs-body-height,78%) * var(--fs-alpha-top,0) / var(--fs-alpha-height,1));height:calc(var(--fs-body-height,78%) / var(--fs-alpha-height,1))}
}

@media(prefers-reduced-motion:reduce){.faction-showcase.has-character-hover .fs-background img{transform:none}}

/* One shared content edge and the requested title/search/filters order. */
/* One temporary, non-interactive snapshot for category crossfade; portrait hover styles stay unchanged. */
.factions-list-page .factions-category-leaving{position:absolute;inset:0;z-index:10;overflow:hidden;pointer-events:none}
.factions-list-page a.fs-badge{text-decoration:none}



/* Local scene controls occupy the existing safe space above the leader heads. */

.factions-list-page [data-category-status][hidden]{display:none!important}
.factions-list-page .fs-categories{position:absolute;z-index:6;top:16px;left:50%;transform:translateX(-50%);display:flex;justify-content:center;flex-wrap:nowrap;gap:8px;margin:0;width:max-content;max-width:calc(100% - 32px)}
/* Original KiwiPedia archive control styling, scoped to the faction selector. */
.factions-list-page .fs-category-controls .fs-categories a{display:inline-flex;align-items:center;justify-content:center;gap:7px;box-sizing:border-box;width:auto;min-width:0;max-width:100%;min-height:34px;padding:7px 12px;border:1px solid #9aff5626;border-radius:999px;background:#05090738;color:#fff;backdrop-filter:blur(8px);box-shadow:none;font:600 10px/1.5 Inter,sans-serif;text-decoration:none;cursor:pointer;transition:border-color .18s,background .18s,color .18s,box-shadow .18s}
.factions-list-page .fs-category-controls .fs-categories a[aria-current=true]{background:#9aff560d;border-color:#9aff5670;color:var(--green,#9aff56);box-shadow:0 0 12px #9aff5610}
.factions-list-page .fs-category-controls .fs-categories a:hover{background:#9aff5612;border-color:#9aff5680;box-shadow:0 0 14px #9aff5618}
.factions-list-page .fs-category-controls .fs-categories a:active{background:var(--bg-soft);box-shadow:inset 0 1px 3px #0005}
.factions-list-page .fs-categories a:focus-visible{outline:2px solid #c3cec6;outline-offset:4px}
.factions-list-page .fs-categories a::before,.factions-list-page .fs-categories a::after{content:none}
.factions-list-page .fs-categories .pedia-control-icon{position:static;width:14px;height:14px;flex:none;color:inherit;stroke:currentColor;pointer-events:none;transform-box:fill-box;transform-origin:center;transition:filter 220ms ease}
@media(prefers-reduced-motion:no-preference){
 .factions-list-page .fs-categories a[aria-current=true] .pedia-control-icon{animation:pedia-control-icon-select 540ms ease both}
 .factions-list-page .fs-categories a:focus-visible .pedia-control-icon{animation:pedia-control-icon-hover 540ms ease both;filter:drop-shadow(0 0 3px currentColor)}
}
@media(prefers-reduced-motion:no-preference) and (hover:hover){
 .factions-list-page .fs-categories a:hover .pedia-control-icon{animation:pedia-control-icon-hover 540ms ease both;filter:drop-shadow(0 0 3px currentColor)}
}
@keyframes pedia-control-icon-hover{0%{transform:translateX(0) scale(1)}25%{transform:translateX(-2.5px) scale(1.06)}55%{transform:translateX(2px) scale(1.12)}100%{transform:translateX(0) scale(1.14)}}
@keyframes pedia-control-icon-select{0%{transform:scale(1);filter:drop-shadow(0 0 0 transparent)}45%{transform:scale(1.15);filter:drop-shadow(0 0 7px var(--green))}100%{transform:scale(1.04);filter:drop-shadow(0 0 0 transparent)}}
@media(max-width:700px){.factions-list-page .fs-categories{top:8px}}
/* Individual translate composes with the existing X transform and child hover scale. */
.faction-showcase[data-faction-entrance=pending] .fs-portrait{opacity:0;translate:0 18px;pointer-events:none;animation:fs-leader-fail-open 0s 8s forwards}
@keyframes fs-leader-fail-open{to{opacity:1;translate:0 0;pointer-events:auto}}
@media(prefers-reduced-motion:reduce){.faction-showcase[data-faction-entrance=pending] .fs-portrait{opacity:1;translate:none;pointer-events:auto}}

/* Viewport composition for the public factions landing page. */
body:has(>.factions-fullscreen) > .footer { display:none; }
.pedia-page.factions-fullscreen {
    --factions-nav-height:88px;
    --fs-viewport:max(230px,calc(100dvh - var(--factions-nav-height)));
    position:relative;
    width:100%;
    max-width:none;
    min-height:0;
    margin:0;
    padding:var(--factions-nav-height) 0 0;
}
.pedia-page--archive.factions-fullscreen > .pedia-archive {
    position:relative;
    width:100%;
    max-width:none;
    margin:0;
    padding:0;
    border:0;
}
.factions-fullscreen .faction-showcase {
    --fs-stage-height:calc(var(--fs-viewport) - 42px);
    box-sizing:border-box;
    display:flex;
    flex-direction:column;
    justify-content:flex-end;
    height:var(--fs-viewport);
    min-height:0;
    padding:0 0 max(10px,env(safe-area-inset-bottom));
}
.factions-fullscreen .fs-stage { position:absolute; inset:0 0 auto; }
.factions-fullscreen .fs-stage::after { background:linear-gradient(transparent,#05090745); }
.factions-fullscreen .fs-background::after {
    background:linear-gradient(90deg,#05090796,transparent 13%,transparent 87%,#05090796),
               linear-gradient(180deg,#05090778,transparent 17%,transparent 59%,#050907 100%);
}
.factions-fullscreen .fs-details { margin:0 auto; min-height:0; }
.factions-fullscreen .fs-detail h3 { font-size:clamp(28px,min(7.5vw,11dvh),108px); }
.factions-fullscreen .fs-accent { margin:10px auto 8px; }
.factions-fullscreen .fs-neutral { padding-bottom:0; }
.factions-fullscreen .fs-hint { margin:5px 10px 8px; }
.factions-fullscreen .fs-badges { padding-bottom:6px; }
.factions-fullscreen .pedia-empty { position:absolute; inset:50% 16px auto; translate:0 -50%; text-align:center; }
@media(max-width:1100px){.pedia-page.factions-fullscreen{--factions-nav-height:76px}}
@media(max-width:700px){
    .factions-fullscreen .faction-showcase{--fs-stage-height:calc(var(--fs-viewport) - 102px)}
    .factions-fullscreen .fs-stage{top:58px}
}
@media(max-height:450px){
    .factions-fullscreen .fs-description{display:none}
    .factions-fullscreen .fs-badge{min-height:34px}
    .factions-fullscreen .fs-badge-photo{width:26px;height:26px}
}
