/* =========================================================================
   RoomLine — GLASS  (first built 2026-10-25; rebuilt 2026-11-15.
   DECISIONS.md "Glass" and "Looks")

   The first build frosted every card on its own over a soft gradient. A
   blurred gradient looks exactly like a gradient, so nothing read as
   glass: there were only pale panels. This build is made of what the eye
   actually takes for glass:

   1. Something to see through it. The backdrops have shapes with edges
      (looks.css, generated), sharp in the margins and soft under the glass.
   2. One sheet. The page is a single frosted pane with a lit rim and a
      grain; cards are clearer panes ON it and are not blurred themselves.
   3. Thickness. Whatever opens over the page — a menu, the flyout, a
      dialog, a toast, the team chat — is thicker glass that blurs what is
      really under it: the cards and the figures, not just a colour.
   4. Light. The rim is brightest along the top edge, shadows are wide and
      soft, and what is selected is a lit white pill.

   It is also far cheaper: one static blur under the page instead of one
   per card re-blurred on every scrolled frame.

   HOW THE BLUR IS LAID OUT, and why it must stay this way. A browser gives
   an element with a backdrop-filter its own "backdrop root": anything
   blurred INSIDE it can only see that element's own contents, and comes
   out unblurred wherever it sticks out past it. An ancestor with opacity
   below 1 does the same. So:
   - The sheet and the tools pill are frosted by a ::before, which has no
     children. Menus and dialogs opening from inside them still see the page.
     That ::before sits at z-index -1 in the page's own stacking order, and
     its parent is deliberately NOT isolated: isolating the tools pill put
     the account menu underneath the sheet.
   - Cards carry a fill and a rim, never a blur.
   - A scrim fades its colour, never its opacity.

   Everything is scoped to html[data-glass]; the values are in looks.css.
   Delete the <link> and every other look is exactly as it was.
   ========================================================================= */

/* ---- 1. The backdrop ---------------------------------------------------- */
html[data-glass] body { background: none; }
html[data-glass] body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--rl-glass-backdrop, var(--rl-glass-bg-warm));
}
html[data-glass] #app {
  --rl-canvas: transparent;
  --rl-line: var(--rl-glass-line);
  background: transparent;
}
/* Drifting: the whole scene moves a few percent, very slowly. It is a
   choice, off by default — a moving backdrop is re-blurred under every
   pane on every frame. */
@keyframes rl-glass-drift {
  from { transform: translate3d(-2%, -1.5%, 0) scale(1.06); }
  to   { transform: translate3d(2%, 2%, 0) scale(1.12) rotate(1.5deg); }
}
html[data-glass][data-drift="drift"] body::before {
  inset: -6%;
  animation: rl-glass-drift 46s ease-in-out infinite alternate;
}
@media (prefers-reduced-motion: reduce) { html[data-glass][data-drift="drift"] body::before { animation: none; } }
html[data-glass][data-drift="drift"][data-motion="off"] body::before { animation: none; }

/* ---- 2. The sheet ------------------------------------------------------- */
html[data-glass] #app .rl-frame::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  border-radius: inherit;
  background: var(--rl-glass-grain), var(--rl-glass-sheet);
  -webkit-backdrop-filter: blur(var(--rl-glass-blur)) saturate(var(--rl-glass-sat));
  backdrop-filter: blur(var(--rl-glass-blur)) saturate(var(--rl-glass-sat));
  box-shadow: inset 0 1px 0 var(--rl-glass-edge), inset 0 0 0 1px var(--rl-glass-edge-soft);
}
@media (min-width: 720px) {
  /* A pane with the backdrop showing all round it, beside the rail. */
  html[data-glass] #app .rl-frame {
    margin: var(--rl-s-3) var(--rl-s-3) var(--rl-s-3) var(--rl-s-4);
    border-radius: calc(var(--rl-r-lg) + var(--rl-s-2));
    overflow: hidden;
    box-shadow: var(--rl-glass-shadow-sheet);
  }
  html[data-glass] #app[data-rail="right"] .rl-frame  { margin: var(--rl-s-3) var(--rl-s-4) var(--rl-s-3) var(--rl-s-3); }
  html[data-glass] #app[data-rail="top"] .rl-frame    { margin: 0 var(--rl-s-3) var(--rl-s-3); }
  html[data-glass] #app[data-rail="bottom"] .rl-frame { margin: var(--rl-s-3) var(--rl-s-3) 0; }
  html[data-glass] body.mdb-tv #app .rl-frame { margin: 0; border-radius: 0; }
}

/* ---- 3. The rail: thin glass, straight on the backdrop ------------------ */
html[data-glass] :is(#app, body) :is(.rl-iconrail-group, .rl-rail-brand, .rl-tabbar) {
  background: var(--rl-glass-chrome);
  -webkit-backdrop-filter: blur(var(--rl-glass-blur-chrome)) saturate(var(--rl-glass-sat));
  backdrop-filter: blur(var(--rl-glass-blur-chrome)) saturate(var(--rl-glass-sat));
  box-shadow: var(--rl-glass-shadow-chrome);
}
html[data-glass] #app .rl-tabbar { border-top-color: var(--rl-glass-edge-soft); }
/* The phone's tab labels were the ramp's mid grey: too faint on smoked glass. */
html[data-glass] #app .rl-tabbar-item { color: var(--rl-text-3); }
html[data-glass] #app .rl-tabbar-item[aria-current="page"] { color: var(--rl-text); }
/* The tools pill holds the account and notification menus, and the phone's
   top bar holds the tools: both are frosted by a ::before so the menus
   that open from them can blur the page. */
@media (min-width: 720px) {
  html[data-glass] #app .rl-iconrail .rl-top-tools { background: none; box-shadow: none; }
  html[data-glass] #app .rl-iconrail .rl-top-tools::before {
    content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
    background: var(--rl-glass-chrome);
    -webkit-backdrop-filter: blur(var(--rl-glass-blur-chrome)) saturate(var(--rl-glass-sat));
    backdrop-filter: blur(var(--rl-glass-blur-chrome)) saturate(var(--rl-glass-sat));
    box-shadow: var(--rl-glass-shadow-chrome);
  }
}
@media (max-width: 719px) {
  html[data-glass] #app .rl-top { background: none; border-bottom-color: var(--rl-glass-edge-soft); }
  html[data-glass] #app .rl-top::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: var(--rl-glass-chrome);
    -webkit-backdrop-filter: blur(var(--rl-glass-blur-chrome)) saturate(var(--rl-glass-sat));
    backdrop-filter: blur(var(--rl-glass-blur-chrome)) saturate(var(--rl-glass-sat));
  }
  html[data-glass] #app .rl-top-tools { background: none; box-shadow: none; }
}

/* ---- 4. Panes: cards on the sheet. A fill, a rim, a shadow — no blur. ---- */
html[data-glass] :is(#app, body) :is(.card, .form-card, .list-card, .property-card, .listing-card, .feed-card,
  .event-card, .automation-card, .aging-card, .chart-card, .today-site, .set-nav) {
  border-color: var(--rl-glass-edge-soft);
  box-shadow: var(--rl-glass-shadow);
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
/* A pane inside a pane is already behind glass: no second rim. */
html[data-glass] #app :is(.card, .form-card, .list-card, .chart-card) :is(.card, .form-card, .list-card, .chart-card) { box-shadow: none; }
html[data-glass] #app :is(a.card, button.card, .card[onclick], .today-site):hover { box-shadow: var(--rl-glass-shadow), 0 18px 34px -22px rgba(22, 24, 34, .5); }

/* ---- 5. Over the page: thick glass that blurs what is under it ---------- */
html[data-glass] :is(#app, body) :is(.rl-pop, .rl-flyout, .dd-panel, .modal-box, .rl-dialog-panel, .rl-drawer,
  .rl-palette-panel, .rl-confirm-panel, .rl-toast, .team-chat, .today-sitecard, .lc-offer, .theme-panel) {
  background: var(--rl-glass-fill-strong);
  -webkit-backdrop-filter: blur(var(--rl-glass-blur-over)) saturate(var(--rl-glass-sat));
  backdrop-filter: blur(var(--rl-glass-blur-over)) saturate(var(--rl-glass-sat));
  border-color: var(--rl-glass-edge-soft);
  box-shadow: var(--rl-glass-shadow-over);
}
/* The scrim dims by colour alone: its own blur, or a fade of its opacity,
   would take the dialog's glass away (see the note at the top). */
html[data-glass] .modal-overlay { -webkit-backdrop-filter: none; backdrop-filter: none; }
@keyframes rl-glass-scrim     { from { background-color: transparent; } }
@keyframes rl-glass-scrim-out { to   { background-color: transparent; } }
html[data-glass] #app .tsc-overlay, html[data-glass] .modal-overlay { animation: rl-glass-scrim var(--rl-d-fast) var(--rl-ease-standard); }
html[data-glass] #appModal[data-closing="true"] { animation: rl-glass-scrim-out var(--rl-d-fast) var(--rl-ease-exit) forwards; }
html[data-glass] #appModal[data-swap="true"] { animation: none; }

/* Full-screen surfaces (the listing and contract wizards, the ops sheet,
   sign-in, the two-factor step, TV mode) painted the canvas, which is
   transparent on glass. They get the backdrop behind a veil, so type set
   straight on them stays readable. js/mfa.js builds its step with inline
   colours, which only !important reaches. */
html[data-glass] :is(.cw-overlay, .sheet, #loginScreen, .mdb-tv-bar) {
  background: linear-gradient(var(--rl-glass-veil), var(--rl-glass-veil)), var(--rl-glass-backdrop, var(--rl-glass-bg-warm));
}
html[data-glass] #rlMfa {
  background: linear-gradient(var(--rl-glass-veil), var(--rl-glass-veil)), var(--rl-glass-backdrop, var(--rl-glass-bg-warm)) !important;
}
html[data-glass] #rlMfa button[type="submit"] { color: var(--rl-btn-fg) !important; background: var(--rl-btn-bg) !important; }
html[data-glass] #rlMfa > div {
  background: var(--rl-glass-fill-strong) !important;
  border-color: var(--rl-glass-edge-soft) !important;
  box-shadow: var(--rl-glass-shadow-over) !important;
  -webkit-backdrop-filter: blur(var(--rl-glass-blur-over)) saturate(var(--rl-glass-sat));
  backdrop-filter: blur(var(--rl-glass-blur-over)) saturate(var(--rl-glass-sat));
}

/* ---- 6. Sticky things: rows pass under frosted headers ------------------ */
html[data-glass] #app :is(.scroll-wrap[data-sticky="true"] table thead th, .mdb-table th, .cal-header-row, .ss-cal-headrow,
  .cw-head, .cw-foot, .cx-setup-foot) {
  -webkit-backdrop-filter: blur(var(--rl-glass-blur-chrome)) saturate(var(--rl-glass-sat));
  backdrop-filter: blur(var(--rl-glass-blur-chrome)) saturate(var(--rl-glass-sat));
}
html[data-glass] :is(.cw-head, .cw-foot) {
  -webkit-backdrop-filter: blur(var(--rl-glass-blur-chrome)) saturate(var(--rl-glass-sat));
  backdrop-filter: blur(var(--rl-glass-blur-chrome)) saturate(var(--rl-glass-sat));
}

/* ---- 7. What is selected is a lit pill ---------------------------------- */
html[data-glass] #app :is(.rl-navitem.is-active, .rl-railitem.is-active, .rl-rail-brand.is-active,
  .rl-fly-item.is-current, .rl-iconrail [aria-pressed="true"]),
html[data-glass] :is(#app, body) :is(.rl-seg button[aria-pressed="true"], .rl-seg button.active,
  .ops-sub-btn.active, .reports-sub-btn.active, .governance-sub-btn.active, .set-item[aria-current="page"]) {
  background: var(--rl-glass-pill); color: var(--rl-glass-pill-ink);
  box-shadow: var(--rl-glass-shadow-pill);
}
html[data-glass] #app .rl-fly-item.is-current .rl-badge { background: var(--rl-glass-pill-ink); color: var(--rl-glass-pill); }
/* Number chips drawn in the surface colour would be see-through. */
html[data-glass] .rl-health-dot[data-n], html[data-glass] #app .rl-fbar-n { color: var(--rl-glass-pill); }

/* Fields: a little more frost than the pane they sit on. */
html[data-glass] :is(#app, body) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) {
  background-color: var(--rl-n-25);
}
html[data-theme="dark"][data-glass] :is(#app, body) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) {
  background-color: var(--rl-surface-sunk);
}

/* ---- 8. A machine that cannot blur, or someone who asked for less ------- */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html[data-glass] { --rl-glass-sheet: linear-gradient(rgba(255, 255, 255, .86), rgba(255, 255, 255, .86)); --rl-glass-fill-strong: rgba(255, 255, 255, .96); --rl-glass-chrome: rgba(255, 255, 255, .9); }
  html[data-theme="dark"][data-glass] { --rl-glass-sheet: linear-gradient(rgba(16, 15, 20, .9), rgba(16, 15, 20, .9)); --rl-glass-fill-strong: rgba(26, 25, 31, .97); --rl-glass-chrome: rgba(24, 23, 29, .92); }
}
@media (prefers-reduced-transparency: reduce) {
  html[data-glass] { --rl-glass-sheet: linear-gradient(rgba(255, 255, 255, .86), rgba(255, 255, 255, .86)); --rl-glass-fill-strong: rgba(255, 255, 255, .96); --rl-glass-chrome: rgba(255, 255, 255, .9); }
  html[data-theme="dark"][data-glass] { --rl-glass-sheet: linear-gradient(rgba(16, 15, 20, .9), rgba(16, 15, 20, .9)); --rl-glass-fill-strong: rgba(26, 25, 31, .97); --rl-glass-chrome: rgba(24, 23, 29, .92); }
}

/* ---- 9. Lite: a low-power PC, or Effects → Fastest (js/shell.js) -------- */
html[data-lite] *, html[data-lite] *::before, html[data-lite] *::after {
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  animation-duration: 1ms !important; animation-iteration-count: 1 !important;
  transition-duration: 1ms !important; scroll-behavior: auto !important;
}
html[data-lite][data-glass] { --rl-glass-sheet: linear-gradient(rgba(255, 255, 255, .94), rgba(255, 255, 255, .94)); --rl-glass-fill-strong: rgba(255, 255, 255, .98); --rl-glass-chrome: rgba(255, 255, 255, .96); }
html[data-lite][data-theme="dark"][data-glass] { --rl-glass-sheet: linear-gradient(rgba(16, 15, 20, .95), rgba(16, 15, 20, .95)); --rl-glass-fill-strong: rgba(26, 25, 31, .98); --rl-glass-chrome: rgba(24, 23, 29, .96); }
html[data-lite] body::before { animation: none !important; }
