/* Vendor Liquid Glass surfaces (frontend/vendor/liquid-glass/).
   Distinct from the house sheet at frontend/css/liquid-glass.css.
   Requires tokens.css. JS sets --lg-filter on .lg */

.lg {
  --lg-filter: none;
  --lg-frost: blur(16px);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: var(--lg-ink);
  background: var(--lg-regular-tint);
  border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius-md);
  box-shadow:
    var(--lg-shadow),
    inset 1.5px 1.5px 0.5px var(--lg-border-inner),
    inset -1px -1px 1px var(--lg-rim-dark);
  backdrop-filter: var(--lg-frost) saturate(var(--lg-regular-sat)) brightness(var(--lg-regular-bright));
  -webkit-backdrop-filter: var(--lg-frost) saturate(var(--lg-regular-sat)) brightness(var(--lg-regular-bright));
  transform: translateZ(0);
  contain: layout style;
}

/* Chromium live refraction — JS replaces --lg-filter with url(#id) */
.lg.lg--live {
  /* Same value on both prefixes — in Blink they alias; a frost -webkit
     declaration here would overwrite the url() filter and kill refraction. */
  backdrop-filter: var(--lg-filter) saturate(var(--lg-regular-sat)) brightness(var(--lg-regular-bright));
  -webkit-backdrop-filter: var(--lg-filter) saturate(var(--lg-regular-sat)) brightness(var(--lg-regular-bright));
}

.lg--clear {
  background: var(--lg-clear-tint);
  backdrop-filter: blur(8px) saturate(var(--lg-clear-sat)) brightness(var(--lg-clear-bright));
  -webkit-backdrop-filter: blur(8px) saturate(var(--lg-clear-sat));
}
.lg--clear.lg--live {
  backdrop-filter: var(--lg-filter) saturate(var(--lg-clear-sat)) brightness(var(--lg-clear-bright));
  -webkit-backdrop-filter: var(--lg-filter) saturate(var(--lg-clear-sat)) brightness(var(--lg-clear-bright));
}

.lg--lens {
  background: var(--lg-lens-tint);
  border-radius: 50%;
}
.lg--lens.lg--live {
  backdrop-filter: var(--lg-filter) saturate(1.25) brightness(1.1);
  -webkit-backdrop-filter: var(--lg-filter) saturate(1.25) brightness(1.1);
}

.lg--pill { border-radius: var(--lg-radius-pill); }
.lg--sm { border-radius: var(--lg-radius-sm); }
.lg--lg { border-radius: var(--lg-radius-lg); }

.lg--bar {
  overflow: visible;
  border-radius: var(--lg-radius-pill);
}

/* Specular plate — behind content, follows --lg-lx/ly */
.lg-spec {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 70% 55% at var(--lg-lx) var(--lg-ly),
      rgba(255, 255, 255, calc(var(--lg-highlight) * 0.9)) 0%,
      rgba(255, 255, 255, 0.08) 34%,
      transparent 62%
    ),
    linear-gradient(
      155deg,
      rgba(255, 255, 255, 0.28) 0%,
      transparent 38%,
      rgba(10, 16, 32, 0.12) 100%
    );
  mix-blend-mode: soft-light;
}

.lg > :not(.lg-spec) {
  position: relative;
  z-index: 1;
}

.lg--elastic {
  transition:
    transform var(--lg-duration) var(--lg-ease),
    box-shadow var(--lg-duration) ease,
    background 160ms ease;
}
.lg--elastic:hover {
  transform: translateY(-1px) scale(1.015);
  box-shadow: var(--lg-shadow-lg),
    inset 1.5px 1.5px 0.5px var(--lg-border-inner),
    inset -1px -1px 1px var(--lg-rim-dark);
}
.lg--elastic:active {
  transform: scale(0.975);
}

.lg:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.28),
    var(--lg-shadow);
}

/* Type plate — use behind labels on clear glass */
.lg-plate {
  display: inline-block;
  padding: 0.15em 0.55em;
  border-radius: 999px;
  background: var(--lg-plate);
}

button.lg {
  appearance: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
  padding: 0.65em 1.15em;
}

@media (prefers-reduced-transparency: reduce) {
  .lg,
  .lg.lg--live,
  .lg--clear,
  .lg--clear.lg--live,
  .lg--lens,
  .lg--lens.lg--live {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--lg-fallback-fill) !important;
    border-color: var(--lg-fallback-border);
  }
  .lg-spec { display: none; }
}

@media (prefers-contrast: more) {
  .lg,
  .lg.lg--live {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--lg-contrast-fill) !important;
    color: var(--lg-contrast-border);
    border: 2px solid var(--lg-contrast-border);
    box-shadow: none;
  }
  .lg-spec { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .lg,
  .lg--elastic,
  .lg--elastic:hover,
  .lg--elastic:active {
    transition: none !important;
    transform: none !important;
  }
}
