/* Default leaves the existing Almanac palette intact. Dark and Daylight use
   VectorShift's reference colours; map artwork retains its own legend colours. */
.rim-theme-switch{display:none;margin:0 0 22px;font:12px/1.5 system-ui,sans-serif}
.rim-themes-ready .rim-theme-switch{display:block}
.rim-theme-switch>span{display:block;margin-bottom:7px;color:#c2cdc3}
.rim-theme-switch>div{display:flex;gap:5px}
.rim-theme-switch button{flex:1;min-width:0;padding:8px 5px;border:1px solid #6d8278;border-radius:3px;background:#213b40;color:#fff4de;font:12px/1.5 system-ui,sans-serif;cursor:pointer}
.rim-theme-switch button:hover{background:#304c4d}
.rim-theme-switch button[aria-pressed=true]{background:#c7a36b;border-color:#c7a36b;color:#192f35;font-weight:700}
.rim-theme-switch button:focus-visible{outline:3px solid #edca92;outline-offset:3px}
@media screen{
  :root[data-rim-theme=dark]{
    --theme-bg:#120f18;--theme-panel:#1a1622;--theme-raised:#231d2e;
    --theme-ink:#ece6dc;--theme-muted:#b6aebd;--theme-line:#352d42;
    --theme-accent:#e9c36c;--theme-link:#f0c877;--theme-hover:#fff3d6;
    --theme-code:#0d0b12;--theme-button-ink:#120f18;--theme-control-line:#756984;
    color-scheme:dark;
  }
  :root[data-rim-theme=day]{
    --theme-bg:#f6f1e6;--theme-panel:#fffaf0;--theme-raised:#efe6d3;
    --theme-ink:#221c28;--theme-muted:#5f5766;--theme-line:#dccfb6;
    --theme-accent:#8a6112;--theme-link:#3e42a8;--theme-hover:#1c1f6b;
    --theme-code:#efe6d3;--theme-button-ink:#fffaf0;--theme-control-line:#9b8f78;
    color-scheme:light;
  }
  :root[data-rim-theme=default]{color-scheme:light}
  :root:is([data-rim-theme=dark],[data-rim-theme=day]){
    --paper:var(--theme-bg);--white:var(--theme-panel);--ink:var(--theme-ink);
    --muted:var(--theme-muted);--line:var(--theme-line);--gold:var(--theme-accent);
    --green:var(--theme-link);--pale:var(--theme-raised);--nav:var(--theme-panel);
    --rim-rail:var(--theme-panel);--rim-rail-ink:var(--theme-ink);--rim-accent:var(--theme-accent);
    accent-color:var(--theme-accent);
  }
  /* Scope palette overrides so Default remains byte-for-byte the old styles. */
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body{background:var(--theme-bg);color:var(--theme-ink)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(a,.rc-links a,.rc-pagehead a,.atlas-detail-links a){color:var(--theme-link)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body a:hover{color:var(--theme-hover)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(.lead,.heroaside p,.notice,.rc-notes){color:var(--theme-ink)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(.card h3 a,.heraldry-emblem strong,#atlas-detail h2){color:var(--theme-ink)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(.breadcrumb,.breadcrumb a,.footer a,.heroaside .num,.atlas-help,#atlas-count,.atlas-directory small,.rc-directory small,.rc-results small,.rc-topbar span,.city-map-help){color:var(--theme-muted)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(.notice,.sources,.pathway,.status-label,.related a,.heroaside,.atlas-app,.rc-viewer,.city-viewer,.change){background:var(--theme-panel);color:var(--theme-ink);border-color:var(--theme-line)}
  /* Earlier city embeds use inline gold links. Override only their help text. */
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body .city-map-help a{color:var(--theme-link)!important}
  /* This is the backdrop of the original light-labelled schematic artwork. */
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body .mapframe{background:#12272e}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body .mapframe .caption a{color:#edc992}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(th,.rc-key,#atlas-detail,.city-details){background:var(--theme-raised);color:var(--theme-ink);border-color:var(--theme-line)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(.card,.heroaside,.notice,.pathway,.rc-selected,#atlas-detail){border-top-color:var(--theme-accent);border-left-color:var(--theme-accent)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(.heroaside .eyebrow,.contents>summary,#atlas-message){color:var(--theme-accent)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(.searchbox input,.rc-search,.atlas-app input[type=search],.atlas-app select,#atlas-message input){background:var(--theme-code);color:var(--theme-ink);border-color:var(--theme-control-line)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body input::placeholder{color:var(--theme-muted);opacity:1}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(.filters button,.maptabs button,.rc-toolbar button,.rc-directory button,.rc-results button,.atlas-app button,.city-toolbar button,.city-keys button){background:var(--theme-raised);color:var(--theme-ink);border-color:var(--theme-control-line)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(.filters button,.maptabs button,.rc-toolbar button,.rc-directory button,.rc-results button,.atlas-app button,.city-toolbar button,.city-keys button):hover{background:var(--theme-panel);border-color:var(--theme-accent)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(.btn,.filters button[aria-pressed=true],.maptabs button[aria-pressed=true],.city-toolbar button[aria-pressed=true],.city-keys button[aria-pressed=true]){background:var(--theme-link);border-color:var(--theme-link);color:var(--theme-button-ink)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body .btn:hover{background:var(--theme-hover);color:var(--theme-button-ink)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body .btn.secondary{background:transparent;color:var(--theme-link)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body .btn.secondary:hover{background:var(--theme-raised);color:var(--theme-hover)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(.contents,.contents .download,.rc-toolbar,.rc-layers,.rc-directory,.rc-page-footer,.rc-sidebar,.atlas-sidebar){border-color:var(--theme-line)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(.atlas-sidebar,.atlas-find>summary,.rc-topbar){background:var(--theme-raised);color:var(--theme-ink);border-color:var(--theme-line)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body .atlas-app label{color:var(--theme-ink)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body #atlas-results{scrollbar-color:var(--theme-control-line) var(--theme-panel)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body .atlas-place-result{border-left-color:var(--theme-accent)!important}
  /* Navigation and its small-screen disclosure use the same three palettes. */
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body .rim-rail{border-color:var(--theme-line);scrollbar-color:var(--theme-control-line) var(--theme-panel)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(.rim-brand,.rim-mobile-bar>a){color:var(--theme-accent)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(.rim-brand small,.rim-nav-heading,.rim-search label,.rim-theme-switch>span){color:var(--theme-muted)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body .rim-nav a{color:var(--theme-ink)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(.rim-nav a:hover,.rim-nav a[aria-current=page]){background:var(--theme-raised);color:var(--theme-link)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body .rim-topbar{background:var(--theme-panel);color:var(--theme-muted);border-color:var(--theme-line)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body .rim-topbar b{color:var(--theme-accent)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body .rim-mobile-bar{background:var(--theme-panel);color:var(--theme-ink);border-color:var(--theme-accent)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(.rim-search input,.rim-search button,.rim-theme-switch button,.rim-mobile-bar button){background:var(--theme-raised);color:var(--theme-ink);border-color:var(--theme-control-line)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(.rim-search button,.rim-theme-switch button,.rim-mobile-bar button):hover{border-color:var(--theme-accent);background:var(--theme-panel)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body .rim-theme-switch button[aria-pressed=true]{background:var(--theme-accent);border-color:var(--theme-accent);color:var(--theme-button-ink)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body :is(a,button,input,select,summary):focus-visible{outline-color:var(--theme-accent)}
  html:is([data-rim-theme=dark],[data-rim-theme=day]) body .skip{background:var(--theme-panel);color:var(--theme-link)}
}
@media print{.rim-theme-switch{display:none!important}}
