/* Physikalisches Glas: the ray-traced surface of a2ui_paint::optics::surface (clear card),
   rendered by the browser as an SVG backdrop filter over the optical engine's maps.
   physical-glass.js measures each surface, loads the map for its size and sets the filter;
   this sheet holds only the layout of the glass layer and the background it refracts.
   The page carries the Rosé wallpaper unless another background is chosen.
   Without url() backdrop filters (non-Chromium) or before the maps arrive, every surface is
   a frosted pane dense enough to read on. */

:root[data-material="physical-glass"] body {
  background: url("physical-glass/wallpapers/rose.webp") center / cover fixed no-repeat, #e7e8f4;
}
/* Contour rings: refraction shows best where fine lines cross a surface edge. */
:root[data-material="physical-glass"][data-pg-bg="contour"] body {
  background:
    repeating-radial-gradient(circle at 22% 38%, transparent 0 13px, color-mix(in srgb, var(--fg) 9%, transparent) 13px 14px),
    repeating-radial-gradient(circle at 80% 70%, transparent 0 17px, color-mix(in srgb, var(--fg) 7%, transparent) 17px 18px),
    var(--bg);
  background-attachment: fixed;
}
:root[data-material="physical-glass"] .a2-shell { background: transparent; }

/* The background, chosen per browser (physical-glass.js sets data-pg-bg on <html>; Rosé
   when unset). Wallpaper URLs are relative to this sheet: every app serves the sheet
   at /static/physical-glass.css and the pictures at /static/physical-glass/wallpapers/. */
:root[data-material="physical-glass"][data-pg-bg="brushed"] body {
  /* Brushed metal: fine horizontal grain at three unrelated periods, so it never repeats
     visibly, over a cool steel ramp with a soft gloss band. */
  background:
    repeating-linear-gradient(0deg, rgb(255 255 255 / .10) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, rgb(20 28 40 / .06) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(0deg, rgb(255 255 255 / .06) 0 2px, transparent 2px 13px),
    repeating-linear-gradient(0deg, rgb(20 28 40 / .04) 0 1px, transparent 1px 29px),
    linear-gradient(172deg, #c3c9d2 0%, #e6e9ee 32%, #f4f6f8 41%, #cfd4dc 58%, #b9c0ca 78%, #d6dbe2 100%);
  background-attachment: fixed;
}
:root[data-material="physical-glass"][data-pg-bg="aurora"] body {
  background: url("physical-glass/wallpapers/aurora.webp") center / cover fixed no-repeat, #1f3a5c;
}
/* The dark wallpapers: a light veil under the glass keeps dark text readable on every tile,
   whichever part of the picture lies behind it. */
:root[data-material="physical-glass"]:is([data-pg-bg="aurora"], [data-pg-bg="night"], [data-pg-bg="neon"], [data-pg-bg="deepsea"]) pg-glass > pg-layer:first-child {
  background-color: rgb(255 255 255 / .58);
}
:root[data-material="physical-glass"]:is([data-pg-bg="aurora"], [data-pg-bg="night"], [data-pg-bg="neon"], [data-pg-bg="deepsea"]) :is(
  .card, .wb-page, .wb-hint, .wb-inspector, .kpi, .a2-duo > section, .a2-duo > article,
  .shell[data-state="arrival"] nav.leftnav :is(a, span)) {
  background: color-mix(in srgb, var(--card-bg) 92%, transparent);
}
/* Text that lies straight on a dark picture (headings, intros, legends): light lettering
   with a soft dark shadow, readable on the picture's dark and light parts alike. Apps mark
   such text with data-pg-on-bg; report-rs's own is listed. */
:root[data-material="physical-glass"]:is([data-pg-bg="aurora"], [data-pg-bg="night"], [data-pg-bg="neon"], [data-pg-bg="deepsea"]) :is(
  [data-pg-on-bg], main > h1, main > .h1-kind, .arrival-intro, .arrival-h2) {
  color: #f3f6fb;
  text-shadow: 0 1px 2px rgb(8 14 28 / .75), 0 0 10px rgb(8 14 28 / .45);
}
:root[data-material="physical-glass"][data-pg-bg="night"] body {
  background: url("physical-glass/wallpapers/night.webp") center / cover fixed no-repeat, #16223a;
}
:root[data-material="physical-glass"][data-pg-bg="morning"] body {
  background: url("physical-glass/wallpapers/morning.webp") center / cover fixed no-repeat, #dfe8f6;
}
:root[data-material="physical-glass"][data-pg-bg="lagoon"] body {
  background: url("physical-glass/wallpapers/lagoon.webp") center / cover fixed no-repeat, #cfe7f6;
}
:root[data-material="physical-glass"][data-pg-bg="mint"] body {
  background: url("physical-glass/wallpapers/mint.webp") center / cover fixed no-repeat, #d3ecf2;
}
:root[data-material="physical-glass"][data-pg-bg="pearl"] body {
  background: url("physical-glass/wallpapers/pearl.webp") center / cover fixed no-repeat, #d8e2f4;
}
:root[data-material="physical-glass"][data-pg-bg="crystal"] body {
  background: url("physical-glass/wallpapers/crystal.webp") center / cover fixed no-repeat, #c9d6e8;
}
:root[data-material="physical-glass"][data-pg-bg="deepsea"] body {
  background: url("physical-glass/wallpapers/deepsea.webp") center / cover fixed no-repeat, #142844;
}
:root[data-material="physical-glass"][data-pg-bg="neon"] body {
  background: url("physical-glass/wallpapers/neon.webp") center / cover fixed no-repeat, #0b1428;
}

:root[data-material="physical-glass"] :is(
  .card, .wb-page, .wb-hint, .wb-inspector, .kpi, .a2-duo > section, .a2-duo > article,
  .shell[data-state="arrival"] nav.leftnav :is(a, span)) {
  position: relative;
  isolation: isolate;
  border-color: color-mix(in srgb, var(--fg) 10%, transparent);
  background: color-mix(in srgb, var(--card-bg) 88%, transparent);
}

/* With the maps loaded: the surface itself is clear; its glass layer refracts. */
:root[data-material="physical-glass"][data-pg-optics] :is(
  .card, .wb-page, .wb-hint, .wb-inspector, .kpi, .a2-duo > section, .a2-duo > article,
  .shell[data-state="arrival"] nav.leftnav :is(a, span)):has(> pg-glass[data-ready]) {
  background: transparent;
  border-color: transparent;
}
pg-glass {
  display: block;
  position: absolute;
  left: -1px;
  top: -1px;
  z-index: -1;
  pointer-events: none;
  border-radius: inherit;
}
pg-glass > pg-layer {
  display: block;
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-size: 100% 100%;
}
:root:not([data-material="physical-glass"]) pg-glass { display: none; }

@media (prefers-reduced-transparency: reduce), (forced-colors: active) {
  :root[data-material="physical-glass"] body { background: var(--bg); }
  :root[data-material="physical-glass"] pg-glass { display: none; }
  :root[data-material="physical-glass"][data-pg-optics] :is(
    .card, .wb-page, .wb-hint, .wb-inspector, .kpi, .a2-duo > section, .a2-duo > article,
    .shell[data-state="arrival"] nav.leftnav :is(a, span)) {
    background: var(--card-bg);
    border-color: var(--border);
  }
}
