/* Navigation du thème et palette commune. Les couleurs propres aux pages
   sont adaptées dans leurs feuilles, sans filtre sur les images ou documents. */
:root {
  --ph-bg:#f8f7fc; --ph-panel:#fff; --ph-ink:#282331; --ph-muted:#696273;
  --ph-line:#ded8e7; --ph-focus:#6c50a1; --ph-action-bg:#62508d;
}
:root[data-site-theme="dark"] {
  color-scheme:dark;
  --ph-bg:#19171f; --ph-panel:#24212c; --ph-ink:#e8e3ed; --ph-muted:#b8afc4;
  --ph-line:#484052; --ph-focus:#c3a9ee; --ph-action-bg:#66518f;
}
.ph-theme-toggle {
  flex:0 0 auto; display:inline-flex; align-items:center; justify-content:center;
  width:40px; height:40px; min-width:40px; padding:8px; border:1px solid var(--ph-line);
  border-radius:50%; background:var(--ph-panel); color:var(--ph-ink); cursor:pointer;
  touch-action:manipulation; pointer-events:auto; line-height:1;
}
.ph-theme-toggle svg {display:block; width:20px; height:20px; flex:0 0 auto;}
.ph-theme-toggle {width:40px!important;height:40px!important;padding:8px!important;}
.ph-theme-toggle:hover {border-color:var(--ph-focus);}
.ph-theme-toggle:focus-visible {outline:3px solid var(--ph-focus);outline-offset:3px;}
.ph-theme-floating {position:fixed;right:max(14px,env(safe-area-inset-right));top:max(14px,env(safe-area-inset-top));z-index:1100;}
.ph-theme-links-actions {display:flex;align-items:center;gap:8px;pointer-events:auto;}
.ph-theme-header-actions {display:flex;align-items:center;gap:8px;min-width:0;}
header.topbar > .ph-theme-header-actions {grid-column:3;grid-row:1;}
.media-topbar > .ph-theme-toggle {margin-left:0;}
.nav-header-actions .ph-theme-toggle {order:-1; margin-right:4px;}
.nav-brand-logo, .library-brand img {object-fit:contain;}
.nav-brand-logo {width:60px;height:42px;}
.nav-brand {width:64px;}
@media(max-width:900px){.nav-brand {width:52px;}.nav-brand-logo {width:50px;height:38px;}.nav-header-actions .ph-theme-toggle {margin-right:0;}.media-topbar {gap:8px;}.media-topbar > .media-return {display:none;}.library-access > span {display:none;}}
@media screen {
  html[data-site-theme="dark"], html[data-site-theme="dark"] body {background-color:var(--ph-bg);color:var(--ph-ink);}
  html[data-site-theme="dark"] :is(input,textarea,select) {color-scheme:dark;}
  html[data-site-theme="dark"] ::selection {background:#59456f;color:#f3eef8;}
  html[data-site-theme="dark"] mark {background:#5b4827;color:#f3e4b9;}
  html[data-site-theme="dark"] :is(.fv-dictionary-panel,.site-search-panel,.student-access-panel,.fv-student-panel,.vault-logout) {background:var(--ph-panel);color:var(--ph-ink);border-color:var(--ph-line);}
  html[data-site-theme="dark"] .links-backdrop {opacity:.6;}
  html[data-site-theme="light"][data-links-view="perso"] {
    --page:#f7f5fc;--ink:#322b43;--muted:#696073;--accent:#6c50a1;
    --edge:#ddd5e5;--card:#fff;--icon-bg:#f1ebf6;--icon-ink:#735488;
    --icon-cutout:#fff;--tab-track:#ebe6f4;--tab-selected:#fff;--tab-ink:#5947a2;
    --card-shadow:0 3px 0 #e8e2f0,0 7px 24px #49305f05;
    color-scheme:light;
  }
}
@media print {
  .ph-theme-toggle,.ph-theme-links-actions {display:none!important;}
  html,body {color-scheme:light!important;}
  body.editor-dark :is(.editor-paper,.editor-canvas,.editor-page-scroll) {background:#fff!important;color:#111!important;}
}
