/* Shared palette and compact controls for the public Wiki and editorial workspace. */
html[data-theme="light"],html[data-theme="light"] body{--color-bg:#f1f3f5;--color-bg-elevated:#fff;--color-surface:#fff;--color-surface-2:#edf0f3;--color-surface-hover:#e7ebef;--color-text:#212529;--color-text-secondary:#343a40;--color-text-muted:#60666d;--color-accent:#f5b105;--color-accent-hover:#d99c00;--color-accent-soft:#fff0c2;--color-border:#e0e3e7;--color-border-strong:#a8afb7}
html[data-theme="dark"],html[data-theme="dark"] body{--color-bg:#14171b;--color-bg-elevated:#1c2025;--color-surface:#1c2025;--color-surface-2:#252b32;--color-surface-hover:#303741;--color-text:#f1f3f5;--color-text-secondary:#d6dbe1;--color-text-muted:#adb5bd;--color-accent:#f5b105;--color-accent-hover:#ffca42;--color-accent-soft:#4b3c13;--color-border:#363d46;--color-border-strong:#657181}
html body .account-trigger,html body .theme-switch-btn{border:0!important;background:transparent!important;box-shadow:none;border-radius:8px;color:var(--color-text);padding:4px 8px;min-height:44px;display:inline-flex;align-items:center;justify-content:center}
html body .theme-switch-btn{width:44px;height:44px}
html body .account-trigger:hover,html body .theme-switch-btn:hover{background:var(--color-surface-hover)!important}
html body .account-trigger:active,html body .theme-switch-btn:active{background:var(--color-surface-2)!important}
html body .account-trigger img{width:40px;height:40px}
html body .account-trigger:focus-visible,html body .theme-switch-btn:focus-visible,.language-trigger:focus-visible,.language-menu button:focus-visible{outline:2px solid var(--vg-focus,#1d78c1);outline-offset:3px}
header .locale{position:relative;flex:none;font:inherit}
header .locale select[hidden]{display:none!important}
.language-trigger,.language-menu button{display:flex;align-items:center;gap:9px;min-height:44px;padding:6px 10px;border:0;border-radius:8px;background:transparent;color:var(--color-text);font:13px var(--font-ui);cursor:pointer;white-space:nowrap}
.language-trigger:hover,.language-menu button:hover{background:var(--color-surface-hover)}
.language-menu{position:absolute;right:0;top:calc(100% + 6px);z-index:1300;padding:6px;background:var(--color-surface);border:1px solid var(--color-border);border-radius:10px;box-shadow:0 8px 24px #0003;min-width:100%;max-width:calc(100vw - 24px)}
.language-menu[hidden]{display:none}.language-menu button{width:100%}
.language-flag{display:inline-block;width:26px;height:26px;flex:0 0 26px;border-radius:50%;border:2px solid var(--color-surface);box-shadow:0 0 0 1px var(--color-border-strong);overflow:hidden}
.flag-ru{background:linear-gradient(#fff 0 33.33%,#174aaf 33.33% 66.66%,#d32634 66.66%)}
.flag-en{background:linear-gradient(90deg,transparent 40%,#fff 40% 44%,#c8102e 44% 56%,#fff 56% 60%,transparent 60%),linear-gradient(transparent 40%,#fff 40% 44%,#c8102e 44% 56%,#fff 56% 60%,transparent 60%),linear-gradient(35deg,transparent 43%,#fff 43% 48%,#c8102e 48% 52%,#fff 52% 57%,transparent 57%),linear-gradient(-35deg,#012169 43%,#fff 43% 48%,#c8102e 48% 52%,#fff 52% 57%,#012169 57%)}
body .site-footer-inner{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;margin-inline:auto;width:min(calc(100% - 32px),1280px)}
body .site-footer-inner nav{display:flex;justify-content:center;flex-wrap:wrap;gap:12px 20px}
body.home-page .home-catalog{padding-top:16px;margin-top:0}
body.home-page .home-cinematic{min-height:clamp(340px,32vw,520px)}
body.home-page .home-cinematic-inner{padding-top:32px;padding-bottom:24px}
body.home-page .trio-panel,body.home-page .trio-list{min-height:0}
body.home-page .trio-feat-copy{padding-bottom:18px}
html[data-theme="light"] body .trio-panel a,html[data-theme="light"] body .site-footer a,html[data-theme="light"] body .home-catalog a{color:var(--color-text)}
html body button.primary,html body .btn-primary{background:var(--color-accent);color:#212529}
.publication-dialog{width:min(540px,calc(100vw - 32px));max-height:calc(100dvh - 40px);box-sizing:border-box;padding:24px;border:1px solid var(--color-border);border-radius:12px;background:var(--color-surface);color:var(--color-text);box-shadow:0 20px 70px #0005;font:14px/1.6 var(--font-ui)}
.publication-dialog::backdrop{background:#0008}.publication-dialog h2{margin:0 0 12px;font:600 22px var(--font-ui)}
.publication-dialog ul{max-height:40dvh;overflow:auto;padding-left:22px;overflow-wrap:anywhere}.publication-dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}
.publication-dialog button{min-height:44px;padding:8px 16px;border:1px solid var(--color-border-strong);border-radius:6px;background:var(--color-surface);color:var(--color-text);cursor:pointer}.publication-dialog button.primary{background:var(--color-accent);color:#212529;border-color:transparent}
@media(max-width:600px){body.home-page .home-cinematic{min-height:340px}.language-trigger{gap:6px;padding-inline:6px}.publication-dialog{padding:18px}}

.forum-direction{margin:12px 0 20px;border:1px solid var(--color-border);border-radius:8px;background:var(--color-surface);overflow:hidden}.forum-direction>summary{padding:16px 20px;cursor:pointer;font-weight:700;list-style:none;display:flex;justify-content:space-between;gap:12px}.forum-direction>summary::after{content:'⌄'}.forum-direction:not([open])>summary::after{content:'›'}.forum-direction .forum-category-group{border:0;border-radius:0}.forum-direction .forum-index-row{grid-template-columns:36px minmax(0,1fr) 72px 250px}.forum-read-marker{display:inline-flex;width:32px;height:32px;border-radius:50%;align-items:center;justify-content:center;background:var(--color-surface-2);color:var(--color-text-muted);font-size:13px}.forum-read-marker.is-unread{background:var(--color-accent);color:#212529}.unread-dot{color:var(--color-accent);font-size:13px}.editorial-catalog-note{display:block;color:var(--color-text-muted);font-size:11px;margin-top:4px}.topic-direction-name{color:var(--color-text-muted);font-size:11px}#direction-list{display:flex;flex-wrap:wrap;gap:8px;margin:16px 0}#direction-form{display:grid;gap:14px;padding:20px;max-width:640px}#direction-form label{display:grid;gap:6px}#direction-form input[type=checkbox]{width:auto;justify-self:start}
@media(max-width:700px){.forum-direction .forum-index-row{grid-template-columns:32px minmax(0,1fr) 48px}.forum-direction .forum-index-last{grid-column:2/-1}.forum-direction>summary{padding:12px}.forum-direction .forum-index-row{padding:12px;gap:10px}}
html[data-theme] body .brand-original .brand-wordmark,html[data-theme] body.forum-workspace .workspace-brand.brand-original .brand-wordmark{background-image:var(--brand-wordmark);filter:none}html[data-theme] body header.top .brand-original .brand-monogram{background-image:var(--brand-emblem);width:42px;height:42px;border-radius:0}

html body header.top .locale{display:block!important}body .site-footer-inner .brand{flex:none}body .site-footer-inner .brand-original{height:auto;margin-inline:auto}html[data-theme="light"] body a:not(.btn-primary):not(.forum-create-button):not(.brand):not(.workspace-brand){--color-accent:#916700}

html body .section-subforum-row{display:grid;grid-template-columns:32px minmax(0,1fr) 240px;align-items:center;gap:14px}html body .section-subforum-row .subforum-name{grid-column:auto}html body .section-subforum-row .subforum-meta{grid-column:auto}@media(max-width:650px){html body .section-subforum-row{grid-template-columns:32px minmax(0,1fr)}html body .section-subforum-row .subforum-meta{grid-column:2}}

@media(max-width:700px){.forum-direction .forum-index-main{grid-column:2;grid-row:1;min-width:0}.forum-direction .forum-index-count{grid-column:3;grid-row:1}.forum-direction .forum-read-marker{grid-column:1;grid-row:1}.forum-direction .forum-index-last{grid-column:2/-1;grid-row:2}.forum-direction .forum-subsection-links{flex-wrap:wrap}}

html[data-theme="light"] .home-cinematic-kicker,html[data-theme="light"] .meta-label,html[data-theme="light"] .trio-kicker,html[data-theme="light"] .trio-row time,html[data-theme="light"] .trio-feat time{color:#916700}

/* Theme colours switch together; native input paint must not lag behind the header. */
html.theme-ready{transition:none}
html[data-theme] body .header-search input,html[data-theme] body .home-search input{appearance:none;-webkit-appearance:none;background:transparent!important;color:var(--color-text);transition:none;color-scheme:inherit}
html[data-theme] body .header-search input::placeholder,html[data-theme] body .home-search input::placeholder{color:var(--color-text-muted);opacity:1}

/* Compact theme slider; the outer button keeps a 44px touch target. */
html body .theme-switch-btn{width:56px;min-width:56px;height:44px;padding:0;flex-shrink:0;border-radius:22px}
html body .theme-switch-btn:hover,html body .theme-switch-btn:active{background:transparent!important}
.theme-slider-track{position:relative;display:block;width:50px;height:28px;border-radius:20px;background:#26343c;box-shadow:inset 0 0 0 1px #ffffff12}
.theme-slider-track svg{position:absolute;top:6px;width:16px;height:16px}
.theme-slider-sun{left:5px;color:#f5c644}
.theme-slider-moon{right:5px;color:#d8c88f}
.theme-slider-thumb{position:absolute;top:4px;left:4px;width:20px;height:20px;border-radius:50%;background:#fff;box-shadow:0 1px 3px #0005;transform:translateX(22px);transition:transform 160ms ease}
html[data-theme=dark] .theme-slider-thumb{transform:translateX(0)}
html[data-theme=light] .theme-slider-moon,html[data-theme=dark] .theme-slider-sun{visibility:hidden}
html body .theme-switch-btn:hover .theme-slider-track{box-shadow:inset 0 0 0 1px #c6a34e88}
@media(prefers-reduced-motion:reduce){.theme-slider-thumb{transition:none}}

/* Fade the complete theme together, including imagery and native form controls. */
html.theme-switching::view-transition-old(root),html.theme-switching::view-transition-new(root){animation-duration:320ms;animation-timing-function:ease-in-out;mix-blend-mode:normal}
html.theme-switching::view-transition{pointer-events:none}
@media(prefers-reduced-motion:no-preference){
 html.theme-fallback,html.theme-fallback body,html.theme-fallback body *{transition-property:background-color,color,border-color,box-shadow,fill,stroke!important;transition-duration:280ms!important;transition-timing-function:ease-in-out!important}
}
@media(prefers-reduced-motion:reduce){html.theme-switching::view-transition-old(root),html.theme-switching::view-transition-new(root){animation:none!important}}

.section-child-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px;margin:0 0 28px}.section-child-card{display:flex;min-height:118px;box-sizing:border-box;flex-direction:column;padding:18px;border:1px solid var(--color-border);border-radius:10px;background:var(--color-surface);color:var(--color-text);text-decoration:none;transition:border-color 160ms ease,transform 160ms ease,background-color 160ms ease}.section-child-card strong{font:700 16px/1.35 var(--font-ui)}.section-child-card small{margin-top:7px;color:var(--color-text-muted);line-height:1.45}.section-child-card>span{margin-top:auto;padding-top:14px;color:var(--color-accent);font-size:12px}.section-child-card:hover,.section-child-card:focus-visible{border-color:var(--color-border-strong);background:var(--color-surface-hover);transform:translateY(-1px)}@media(max-width:560px){.section-child-grid{grid-template-columns:1fr}.section-child-card{min-height:0}}
