/*! Liquid Glass style layer · Paradise Glass v1.0.0 (2026-11-20)
 * © 2026 Create Paradise Now. Licensed under the Paradise Glass product license (LICENSE-PRODUCT.md). Third-party parts: see THIRD_PARTY_NOTICES.md
 * Portions (glass material tokens, uneven rim light, sheen, accessibility ladder) are adapted from assets/tokens.css of
 * "Apple Liquid Glass — an agent skill", https://github.com/xenitV1/liquid-glass-skill (@8cf508b),
 * MIT License, Copyright (c) 2026 Xenit (Mehmet); those portions stay under MIT (full text in THIRD_PARTY_NOTICES.md).
 * CPN changes: tokens scoped to the glass and prefixed --lg-* (no :root, no body styles, no clash with a site's
 * own --glass), dark tone, surface and copy layers, interactive light.
 * Refraction itself comes from liquid-glass.js (liquidglass.dev engine, MIT © 2026 gentpan) wired by cpn-glass.js.
 * Paint-only: no width, height, padding, margin or border changes → no layout shift.
 */
.glass, .glass-clear {
  --lg-glass: rgba(252, 252, 254, .72);         /* regular glass: close to opaque */
  --lg-glass-thick: rgba(252, 252, 254, .94);   /* reduced transparency, no backdrop-filter */
  --lg-glass-refract: rgba(252, 252, 254, .5);  /* tint while the backdrop is really bent */
  --lg-glass-blur: saturate(180%) blur(24px);   /* frost where refraction is impossible */
  --lg-rim: rgba(255, 255, 255, .85);
  --lg-rim-2: rgba(255, 255, 255, .35);
  --lg-rim-1: rgba(255, 255, 255, .9);          /* rim light: brightest upper left … */
  --lg-rim-mid: rgba(255, 255, 255, .16);       /* … faint along the middle … */
  --lg-rim-3: rgba(255, 255, 255, .55);         /* … picks up lower right */
  --lg-sheen: .3;
  --lg-shadow: 0 8px 26px rgba(0, 0, 0, .1), 0 1px 3px rgba(0, 0, 0, .06);
  position: relative;
  isolation: isolate;
}
.glass {
  background-color: var(--lg-glass);
  -webkit-backdrop-filter: var(--lg-glass-blur);
  backdrop-filter: var(--lg-glass-blur);
  box-shadow: inset 0 .5px 0 var(--lg-rim), inset 0 0 0 .5px var(--lg-rim-2), var(--lg-shadow);
}
.glass.is-refracting { background-color: var(--lg-glass-refract); }
.glass.glass-text.is-refracting { background-color: var(--lg-glass); }   /* menus, sheets: words first */
/* While the page scrolls (cpn-glass.js sets html.lg-scrolling): the glass's own plain blur instead of the url()
   refraction, which Chromium re-renders on every frame the backdrop moves. !important beats the engine's inline value. */
html.lg-scrolling .is-refracting:not(.is-copy) {
  -webkit-backdrop-filter: blur(var(--lg-scroll-blur, 2px)) !important;
  backdrop-filter: blur(var(--lg-scroll-blur, 2px)) !important;
}

/* Dark tone, for dark sections and light labels */
.glass--dark {
  --lg-glass: rgba(24, 18, 13, .72);
  --lg-glass-thick: rgba(24, 18, 13, .95);
  --lg-glass-refract: rgba(18, 12, 8, .42);
  --lg-rim: rgba(255, 236, 205, .26);
  --lg-rim-2: rgba(255, 236, 205, .08);
  --lg-rim-1: rgba(255, 236, 205, .5);
  --lg-rim-mid: rgba(255, 236, 205, .05);
  --lg-rim-3: rgba(255, 236, 205, .22);
  --lg-sheen: .1;
  --lg-shadow: 0 22px 48px -20px rgba(0, 0, 0, .75), 0 1px 3px rgba(0, 0, 0, .4);
}

/* Specular sheen: the detail that separates Liquid Glass from glassmorphism */
.glass::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, var(--lg-sheen)) 0%,
    rgba(255, 255, 255, calc(var(--lg-sheen) * .2)) 34%, transparent 62%);
}
/* Rim: an uneven gradient edge, a thick bevel catching light, never a 1px sticker border */
.glass::before, .glass-clear::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  background: linear-gradient(135deg, var(--lg-rim-1) 0%, var(--lg-rim-mid) 45%, var(--lg-rim-3) 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);
}

/* Clear variant: only over photos or video; add .glass-dim when the media is bright (Apple: 35 %) */
.glass-clear {
  background-color: rgba(255, 255, 255, .18);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
}
.glass-clear.is-refracting { background-color: rgba(255, 255, 255, .1); }
.glass-dim { background-image: linear-gradient(rgba(0, 0, 0, .35), rgba(0, 0, 0, .35)); }

/* Surface mode: the glass is a layer inside a positioned host, so a bar keeps its own box */
.glass.lg-surface, .glass-clear.lg-surface {
  position: absolute;
  inset: var(--lg-inset, 0);
  z-index: -1;
  border-radius: var(--lg-radius, 999px);
  pointer-events: none;
}

/* Copy mode (refracts in every engine): an aligned copy of a known backdrop sits inside the
   glass and is bent with a plain CSS filter; the tint moves onto a layer above it */
.lg-copy, .lg-copy__tint {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}
.lg-copy__src { position: absolute; left: 0; top: 0; margin: 0; }
.glass.is-copy { background-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.glass.is-copy > .lg-copy__tint { background-color: var(--lg-glass-refract); }

/* Interactive glass: light follows the pointer, spring press */
.lg--interactive {
  background-image: radial-gradient(180px circle at var(--lg-mx, 50%) var(--lg-my, -80%), rgba(255, 255, 255, .3), transparent 70%);
  transition: transform .5s cubic-bezier(.16, 1, .3, 1);
}
.lg--interactive:active { transform: scale(.975); }

/* Fallback ladder */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .glass-clear { background-color: var(--lg-glass-thick); }
}
.lg-solid .glass, .lg-solid .glass-clear {
  background-color: var(--lg-glass-thick);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
@media (prefers-reduced-transparency: reduce) {
  .glass, .glass-clear, .glass.is-refracting {
    background-color: var(--lg-glass-thick) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
  .glass::after, .lg-copy { display: none; }
}
@media (prefers-contrast: more) {
  .glass, .glass-clear, .glass.is-refracting { background-color: var(--lg-glass-thick) !important; }
  .glass::before, .glass-clear::before { background: currentColor; opacity: .55; }
}
@media (forced-colors: active) {
  .glass, .glass-clear {
    background: Canvas !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    outline: 1px solid CanvasText;
    outline-offset: -1px;
  }
  .glass::before, .glass::after, .glass-clear::before, .lg-copy { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lg--interactive { transition: none; }
  .lg--interactive:active { transform: none; }
}
