/* =====================================================================
   The ArtHistory.org / AES — Swiss Editorial Glassmorphism layer
   Opt-in: active only when <html> has class "aes-glass".
   Loaded last on each page; it restyles surfaces only — no layout,
   data, links or scripts are changed. Remove the class to switch off.
   ===================================================================== */
html.aes-glass {
  --g-purple: #753BFF; --g-lime: #C5F500; --g-orange: #FF8A00; --g-ink: #111111;
  --g-field: #EFEEEA;
  --g-glass: rgba(255,255,255,.62);
  --g-glass-strong: rgba(255,255,255,.80);
  --g-edge: rgba(255,255,255,.88);
  --g-hair: rgba(17,17,17,.12);
  --g-shadow: 0 12px 44px rgba(17,17,17,.10);
  --g-blur: blur(26px) saturate(150%);
  --g-r: 24px;
  background: var(--g-field) !important;
}
html.aes-glass body { background: transparent !important; position: relative; }

/* ---------- Background field ----------
   The purple disc, lime slab and orange block behind the glass were removed on 2026-11-26
   at the owner's request: the page background is now the plain field colour only. */

/* ---------- Glass recipe ---------- */
html.aes-glass body > :is(div.wrap, main.wrap, div.container, div.app, header.top, section.hero, div.stats-wrap, nav.toc, section.block, aside.page-note, div.header, div.layout, header:not([class]), main#app, div.shell, form#f, main:not([class]):not([id])) {
  background: var(--g-glass) !important;
  -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur);
  border: 1px solid var(--g-edge) !important;
  border-radius: var(--g-r);
  box-shadow: var(--g-shadow);
  width: min(var(--g-max, 100%), calc(100% - 40px));
  margin-left: auto !important; margin-right: auto !important;
  margin-top: 20px; margin-bottom: 20px;
  box-sizing: border-box;
}
/* blocks that sit flush against each other in the original become stacked sheets */
html.aes-glass body > section.block + section.block,
html.aes-glass body > header.top + section.hero { margin-top: 14px; }

/* ---------- Shared navigation: glass bar (not sticky — several modules have their own sticky panels) ---------- */
html.aes-glass #aes-site-navigation {
  background: rgba(255,255,255,.66) !important;
  -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur);
  border-bottom: 1px solid var(--g-edge) !important;
  box-shadow: 0 1px 0 var(--g-hair), 0 8px 30px rgba(17,17,17,.06);
}
html.aes-glass #aes-site-navigation .aesnav-related { border-top-color: var(--g-hair); }
html.aes-glass #aes-site-navigation .aesnav-mark .aesnav-pill { border-radius: 999px; border-color: transparent; padding: 5px 9px; }
html.aes-glass #aes-site-navigation .aesnav-link { border-radius: 999px; border-bottom: 0; padding-left: 11px; padding-right: 11px; }
html.aes-glass #aes-site-navigation .aesnav-link:hover,
html.aes-glass #aes-site-navigation .aesnav-link[aria-current=page] { background: var(--g-purple); color: #fff; }
html.aes-glass #aes-site-navigation .aesnav-tools summary,
html.aes-glass #aes-site-navigation .aesnav-mobile summary { border-radius: 999px; }
html.aes-glass #aes-site-navigation .aesnav-tools summary { background: rgba(255,255,255,.6); }
html.aes-glass #aes-site-navigation .aesnav-tools-menu,
html.aes-glass #aes-site-navigation .aesnav-mobile-menu {
  background: rgba(255,255,255,.86) !important;
  -webkit-backdrop-filter: var(--g-blur); backdrop-filter: var(--g-blur);
  border: 1px solid var(--g-edge); border-radius: 18px; box-shadow: var(--g-shadow);
}
html.aes-glass #aes-site-navigation .aesnav-tools-menu a,
html.aes-glass #aes-site-navigation .aesnav-mobile-menu a { border-radius: 10px; border-bottom-color: var(--g-hair); }

/* ---------- Site footer: dark glass ---------- */
html.aes-glass footer.tah-foot {
  background: rgba(17,17,17,.88) !important;
  -webkit-backdrop-filter: blur(26px) saturate(140%); backdrop-filter: blur(26px) saturate(140%);
  border-radius: var(--g-r) var(--g-r) 0 0;
  margin-top: 28px;
}

/* ---------- Inner surfaces ----------
   Only elements with a full, even border get rounded corners. Elements drawn
   with a single rule (left accent bar, column divider, underline field,
   segmented tabs) stay square, as in the Swiss original. */
html.aes-glass :is(.notice, aside.scope, .preview pre) { background: var(--g-glass-strong) !important; }
html.aes-glass :is(input, select, textarea):not(.sw-sel):not(.ss-search):not([type=checkbox]):not([type=radio]):not([type=range]) { border-radius: 10px; }
html.aes-glass :is(input, select, textarea):not([type=checkbox]):not([type=radio]):not([type=range]) { background-color: rgba(255,255,255,.82); }
html.aes-glass .sw-sel, html.aes-glass .ss-search { background-color: transparent; }
/* standalone outlined buttons → capsules (not in the Explorer, whose buttons are joined tab strips) */
html.aes-glass body:not(:has(#cats)) :is(.btn, .button, .nav a, .types button) { border-radius: 999px; }
html.aes-glass .preview-bar { border-radius: 0; }

/* drawing canvases and 3D viewports stay solid so linework reads cleanly */
html.aes-glass :is(#dwrap, svg#dwg, main#viewer, .viewer, .canvas-box, section.stage) { border-radius: 16px; overflow: hidden; }

/* ---------- Comfort + fallbacks ---------- */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html.aes-glass body > :is(div.wrap, main.wrap, div.container, div.app, header.top, section.hero, div.stats-wrap, nav.toc, section.block, aside.page-note, div.header, div.layout, header:not([class]), main#app, div.shell, form#f, main:not([class]):not([id])),
  html.aes-glass #aes-site-navigation { background: rgba(255,255,255,.95) !important; }
}
@media (prefers-reduced-transparency: reduce) {
  html.aes-glass #aes-site-navigation,
  html.aes-glass body > * { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  html.aes-glass body::before, html.aes-glass body::after { display: none; }
}
@media (max-width: 760px) {
  html.aes-glass { --g-r: 18px; }
  html.aes-glass body::after { box-shadow: none; }
}
@media print {
  html.aes-glass { background: #fff !important; }
  html.aes-glass body::before, html.aes-glass body::after { display: none; }
  html.aes-glass body > * { box-shadow: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; background: #fff !important; }
}

/* Explorer on phones: its bottom panel is position:fixed inside .wrap; backdrop-filter would trap it */
@media (max-width: 780px) {
  html.aes-glass body > div.wrap:has(.panel) {
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
    background: rgba(255,255,255,.9) !important;
  }
}
/* Belief layer had no stylesheet of its own; it now borrows the Iconography layer CSS — recolour its accent to brand purple */
html.aes-glass body:has(#stats.summary) { --mag: var(--g-purple); }
html.aes-glass .notice { border-left: 6px solid var(--g-orange); padding: 12px 16px; margin: 18px 0; font-size: 13px; }
