/* Liquid glass: React Bits' GlassSurface look (reactbits.dev, "GlassSurface", JavaScript + CSS), driven by
   public/glass-surface.js. The glass layers (--svg bends the backdrop, --fallback frosts it) are the component's own CSS;
   the sheen and rim it draws as spans on the frosted glass only are that surface's ::before and ::after here, so a
   surface whose children are replaced (the suggestions list) keeps them. light-dark() follows the page's colour-scheme,
   which follows Appearance. */
.glass-surface { position: relative; transition: opacity 0.26s ease-out; }
.glass-surface__filter { width: 0; height: 0; position: absolute; pointer-events: none; opacity: 0; }
/* Safari (every iPhone browser) and Firefox can't bend the backdrop, so the frosted look is drawn to read like the bent
   glass instead: a softly frosted middle, a brighter band round the edge where the bend would be (::before),
   a thin lit rim brightest top-left and bottom-right (::after), and a faint red/blue fringe along the sides like the
   component's colour split (greenOffset 10, blueOffset 20). */
.glass-surface--fallback::before, .glass-surface--fallback::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }
.glass-surface--fallback::before {
  background:
    linear-gradient(180deg, light-dark(hsl(0 0% 100% / 0.34), hsl(0 0% 100% / 0.1)) 0%, transparent 38%),
    radial-gradient(closest-side at 50% 50%, transparent 72%, light-dark(hsl(0 0% 100% / 0.22), hsl(0 0% 100% / 0.07)) 100%);
  box-shadow:
    inset 0 0 6px 1px light-dark(hsl(0 0% 100% / 0.5), hsl(0 0% 100% / 0.12)),
    inset 0 0 18px 4px light-dark(hsl(0 0% 100% / 0.28), hsl(0 0% 100% / 0.06)),
    inset 3px 0 4px -2px light-dark(hsl(350 100% 60% / 0.28), hsl(350 100% 70% / 0.32)),
    inset -3px 0 4px -2px light-dark(hsl(200 100% 50% / 0.3), hsl(200 100% 70% / 0.34));
}
.glass-surface--fallback::after {
  padding: 1.5px;
  background: linear-gradient(135deg, light-dark(hsl(0 0% 100% / 0.95), hsl(0 0% 100% / 0.6)) 0%, light-dark(hsl(0 0% 100% / 0.25), hsl(0 0% 100% / 0.1)) 30%,
    light-dark(hsl(0 0% 100% / 0.12), hsl(0 0% 100% / 0.04)) 55%, light-dark(hsl(0 0% 100% / 0.8), hsl(0 0% 100% / 0.4)) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

.glass-surface--svg {
  background: light-dark(hsl(0 0% 100% / var(--glass-frost, 0)), hsl(0 0% 0% / var(--glass-frost, 0)));
  backdrop-filter: var(--filter-id, url(#glass-filter)) saturate(var(--glass-saturation, 1));
  box-shadow:
    0 0 2px 1px light-dark(color-mix(in oklch, black, transparent 85%), color-mix(in oklch, white, transparent 65%))
      inset,
    0 0 10px 4px light-dark(color-mix(in oklch, black, transparent 90%), color-mix(in oklch, white, transparent 85%))
      inset,
    0px 4px 16px rgba(17, 17, 26, 0.05),
    0px 8px 24px rgba(17, 17, 26, 0.05),
    0px 16px 56px rgba(17, 17, 26, 0.05),
    0px 4px 16px rgba(17, 17, 26, 0.05) inset,
    0px 8px 24px rgba(17, 17, 26, 0.05) inset,
    0px 16px 56px rgba(17, 17, 26, 0.05) inset;
}

.glass-surface--fallback {
  background: light-dark(
    hsl(0 0% 100% / calc(0.1 + var(--glass-frost, 0) * 0.5)),
    hsl(220 30% 8% / calc(0.08 + var(--glass-frost, 0) * 0.8))
  );
  -webkit-backdrop-filter: blur(16px) saturate(calc(var(--glass-saturation, 1) * 1.6)) brightness(1.06);
  backdrop-filter: blur(16px) saturate(calc(var(--glass-saturation, 1) * 1.6)) brightness(1.06);
  box-shadow:
    0px 4px 16px rgba(17, 17, 26, 0.08),
    0px 8px 24px rgba(17, 17, 26, 0.08),
    0px 16px 56px rgba(17, 17, 26, 0.08);
}

/* The search bar's frosted glass has no border: no lit rim, no glowing edge, no colour fringe. */
#barGlass.glass-surface--fallback::after { content: none; }
#barGlass.glass-surface--fallback::before { box-shadow: none; }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-surface--fallback { background: light-dark(hsl(0 0% 100% / 0.72), hsl(0 0% 12% / 0.72)); }
}
