/*!
 * liquid-glass.css — Apple Liquid Glass (iOS 26 / macOS Tahoe) material for the web.
 * Pairs with liquid-glass.js (edge refraction via SVG displacement, Chromium).
 * Without the JS (or on Safari/Firefox) it degrades to a premium frost fallback.
 *
 * Anatomy of the material (bottom to top):
 *   1. Refraction/frost  — ::before backdrop-filter (SVG lens filter or blur+saturate)
 *   2. Tint + specular   — ::before background wash + inset highlight shadows
 *   3. Rim light         — ::after conic-gradient ring (bright top, dim sides, warm bottom)
 *   4. Content           — .rf-case-lg-content (vibrancy text)
 *   plus a soft drop shadow under the whole element.
 *
 * Usage: <div class="rf-case-lg rf-case-lg-card">…<div class="rf-case-lg-content">…</div></div>
 */

.rf-case-lg {
  /* ---- tunables (override per element / theme) ---- */
  --rf-case-lg-radius: 28px;

  /* refraction engine (read by liquid-glass.js) */
  --rf-case-lg-refraction: 80;     /* displacement scale, px of bend at the rim   */
  --rf-case-lg-band: 16;           /* how far the lens band reaches inward, px    */
  --rf-case-lg-curve: 2.8;         /* falloff exponent — higher = tighter lens    */
  --rf-case-lg-aberration: 0.18;   /* chromatic fringe amount at the rim          */
  --rf-case-lg-blur-svg: 16;       /* blur INSIDE the svg filter (refraction path)*/
  --rf-case-lg-saturate-svg: 1.9;  /* saturation inside the svg filter            */

  /* fallback path (Safari / Firefox / no-JS) */
  --rf-case-lg-blur: 20px;
  --rf-case-lg-saturate: 1.9;
  --rf-case-lg-brightness: 1.07;

  /* tint + lighting */
  --rf-case-lg-tint: 255 255 255;
  --rf-case-lg-tint-a: 0.19;
  --rf-case-lg-rim-w: 1.5px;       /* rim ring thickness                          */
  --rf-case-lg-rim-top: 0.9;       /* rim opacity at the top edge                 */
  --rf-case-lg-rim-side: 0.18;     /* rim opacity on the sides                    */
  --rf-case-lg-rim-bottom: 0.65;   /* rim opacity at the bottom edge              */
  --rf-case-lg-spec-hi: 0.5;       /* soft inner specular, light side             */
  --rf-case-lg-spec-lo: 0.3;       /* soft inner specular, counter side           */
  --rf-case-lg-shadow: 0 12px 32px rgba(0, 0, 0, 0.24), 0 2px 8px rgba(0, 0, 0, 0.16);

  position: relative;
  border-radius: var(--rf-case-lg-radius);
  isolation: isolate;
  box-shadow: var(--rf-case-lg-shadow);
  /* keep the filter region honest when animating */
  transform: translateZ(0);
}

/* 1+2 — refraction / frost + tint + soft specular */
.rf-case-lg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background: rgb(var(--rf-case-lg-tint) / var(--rf-case-lg-tint-a));
  box-shadow:
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.1),
    inset 1px 1px 3px -1.5px rgba(255, 255, 255, var(--rf-case-lg-spec-hi)),
    inset -1px -1px 3px -1.5px rgba(255, 255, 255, var(--rf-case-lg-spec-lo)),
    inset 0 -10px 20px -12px rgba(0, 0, 0, 0.18);
  -webkit-backdrop-filter: blur(var(--rf-case-lg-blur)) saturate(var(--rf-case-lg-saturate)) brightness(var(--rf-case-lg-brightness));
  backdrop-filter: blur(var(--rf-case-lg-blur)) saturate(var(--rf-case-lg-saturate)) brightness(var(--rf-case-lg-brightness));
}
/* Chromium + JS: swap the frost for the true lens filter */
.rf-case-lg-refraction .rf-case-lg::before {
  -webkit-backdrop-filter: var(--rf-case-lg-filter, blur(var(--rf-case-lg-blur)) saturate(var(--rf-case-lg-saturate)));
  backdrop-filter: var(--rf-case-lg-filter, blur(var(--rf-case-lg-blur)) saturate(var(--rf-case-lg-saturate)));
}

/* 3 — rim light: conic ring, brightest at top, dim sides, warm glow at bottom */
.rf-case-lg::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  pointer-events: none;
  padding: var(--rf-case-lg-rim-w);
  background: conic-gradient(from 0deg at 50% 50%,
    rgba(255, 255, 255, var(--rf-case-lg-rim-top)) 0deg,
    rgba(255, 255, 255, calc(var(--rf-case-lg-rim-side) + 0.04)) 70deg,
    rgba(255, 255, 255, var(--rf-case-lg-rim-side)) 110deg,
    rgba(255, 255, 255, var(--rf-case-lg-rim-bottom)) 180deg,
    rgba(255, 255, 255, var(--rf-case-lg-rim-side)) 250deg,
    rgba(255, 255, 255, calc(var(--rf-case-lg-rim-side) + 0.04)) 290deg,
    rgba(255, 255, 255, var(--rf-case-lg-rim-top)) 360deg);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
}

/* 4 — on-glass content */
.rf-case-lg-content { position: relative; z-index: 2; }
.rf-case-lg-label {
  color: rgba(255, 255, 255, 0.96);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.rf-case-lg-secondary { color: rgba(255, 255, 255, 0.62); }

/* ============================= variants ============================= */

/* Clear — for media-rich backdrops: more transparent, less frost */
.rf-case-lg-clear {
  --rf-case-lg-tint-a: 0.07;
  --rf-case-lg-blur: 6px;
  --rf-case-lg-blur-svg: 5;
  --rf-case-lg-brightness: 1.02;
  --rf-case-lg-rim-top: 0.75;
}

/* Tinted — set --rf-case-lg-tint to an RGB triplet on the element */
.rf-case-lg-tinted { --rf-case-lg-tint-a: 0.5; }

/* ============================= shapes =============================== */

.rf-case-lg-capsule {
  --rf-case-lg-radius: 999px;
  --rf-case-lg-band: 13;
  --rf-case-lg-refraction: 66;
  --rf-case-lg-blur-svg: 14;
  border: 0;
  padding: 14px 28px;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  color: inherit;
  background: none;
}

.rf-case-lg-toolbar {
  --rf-case-lg-radius: 999px;
  --rf-case-lg-band: 13;
  --rf-case-lg-refraction: 66;
  --rf-case-lg-blur-svg: 14;
}

.rf-case-lg-card { --rf-case-lg-radius: 28px; --rf-case-lg-blur-svg: 22; }

.rf-case-lg-dock {
  --rf-case-lg-radius: 32px;
  --rf-case-lg-band: 20;
  --rf-case-lg-refraction: 90;
  touch-action: none;
}

/* =========================== interaction ============================ */

.rf-case-lg-interactive {
  transition:
    transform 0.45s cubic-bezier(0.34, 1.3, 0.5, 1),
    box-shadow 0.45s cubic-bezier(0.34, 1.3, 0.5, 1);
}
.rf-case-lg-interactive:hover { transform: translateZ(0) scale(1.03); }
.rf-case-lg-interactive:active {
  transform: translateZ(0) scale(1.07);
  transition-duration: 0.12s;
}
.rf-case-lg-interactive:active::before { background: rgb(var(--rf-case-lg-tint) / calc(var(--rf-case-lg-tint-a) + 0.08)); }

/* ========================== light theme ============================= */

[data-rf-case-lg-theme="light"] .rf-case-lg,
.rf-case-lg[data-rf-case-lg-theme="light"] {
  --rf-case-lg-tint-a: 0.4;
  --rf-case-lg-brightness: 1.08;
  --rf-case-lg-rim-top: 1;
  --rf-case-lg-rim-side: 0.35;
  --rf-case-lg-rim-bottom: 0.8;
  --rf-case-lg-spec-hi: 0.9;
  --rf-case-lg-spec-lo: 0.5;
  --rf-case-lg-shadow: 0 10px 28px rgba(0, 20, 40, 0.14), 0 2px 6px rgba(0, 20, 40, 0.08);
}
[data-rf-case-lg-theme="light"] .rf-case-lg-label { color: rgba(29, 29, 31, 0.92); }
[data-rf-case-lg-theme="light"] .rf-case-lg-secondary { color: rgba(29, 29, 31, 0.6); }
[data-rf-case-lg-theme="light"] .rf-case-lg::before {
  box-shadow:
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.35),
    inset 1px 1px 3px -1.5px rgba(255, 255, 255, var(--rf-case-lg-spec-hi)),
    inset -1px -1px 3px -1.5px rgba(255, 255, 255, var(--rf-case-lg-spec-lo)),
    inset 0 -10px 20px -12px rgba(0, 30, 60, 0.1);
}

/* ==================== adaptive (set by the JS) ====================== */
/* The engine samples backdrop brightness and sets data-rf-case-lg-auto="light|dark".
   Manual data-rf-case-lg-theme on the element or an ancestor always wins (the JS
   skips those elements entirely). */

.rf-case-lg::before {
  transition: background-color 0.4s ease, box-shadow 0.4s ease;
}
.rf-case-lg-label, .rf-case-lg-secondary { transition: color 0.4s ease; }

.rf-case-lg[data-rf-case-lg-auto="light"] {
  --rf-case-lg-tint-a: 0.4;
  --rf-case-lg-brightness: 1.08;
  --rf-case-lg-rim-top: 1;
  --rf-case-lg-rim-side: 0.35;
  --rf-case-lg-rim-bottom: 0.8;
  --rf-case-lg-spec-hi: 0.9;
  --rf-case-lg-spec-lo: 0.5;
  --rf-case-lg-shadow: 0 10px 28px rgba(0, 20, 40, 0.14), 0 2px 6px rgba(0, 20, 40, 0.08);
}
.rf-case-lg[data-rf-case-lg-auto="light"] .rf-case-lg-label { color: rgba(29, 29, 31, 0.92); }
.rf-case-lg[data-rf-case-lg-auto="light"] .rf-case-lg-secondary { color: rgba(29, 29, 31, 0.6); }
.rf-case-lg[data-rf-case-lg-auto="light"]::before {
  box-shadow:
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.35),
    inset 1px 1px 3px -1.5px rgba(255, 255, 255, var(--rf-case-lg-spec-hi)),
    inset -1px -1px 3px -1.5px rgba(255, 255, 255, var(--rf-case-lg-spec-lo)),
    inset 0 -10px 20px -12px rgba(0, 30, 60, 0.1);
}

/* ======================= reduced transparency ======================= */

@media (prefers-reduced-transparency: reduce) {
  .rf-case-lg::before {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background: rgb(40 40 45 / 0.92);
  }
  [data-rf-case-lg-theme="light"] .rf-case-lg::before { background: rgb(245 245 248 / 0.94); }
}
