/* ═══════════════════════════════════════════════════════════════════════════
 * Kallisto Design System — Liquid Glass Theme
 * Inspired by Apple iOS 26 Liquid Glass: translucent refractive surfaces,
 * specular edge highlights, layered depth, concentric rounded corners,
 * and fluid morphing controls.
 * 
 * Blends with existing Kallisto tokens (oklch colors, Geist type, etc.)
 * ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Liquid Glass tokens ─────────────────────────────────────────────── */
  --lg-blur:          24px;
  --lg-blur-strong:   40px;
  --lg-blur-subtle:   12px;
  --lg-saturation:    1.8;
  --lg-bg:            rgba(255, 255, 255, 0.28);
  --lg-bg-hover:      rgba(255, 255, 255, 0.38);
  --lg-bg-active:     rgba(255, 255, 255, 0.48);
  --lg-bg-dark:       rgba(0, 0, 0, 0.15);
  --lg-bg-dark-hover: rgba(0, 0, 0, 0.22);
  --lg-border:        rgba(255, 255, 255, 0.35);
  --lg-border-bright: rgba(255, 255, 255, 0.55);
  --lg-border-subtle: rgba(255, 255, 255, 0.18);
  --lg-specular:      rgba(255, 255, 255, 0.7);
  --lg-specular-thin: rgba(255, 255, 255, 0.4);
  --lg-refract-color: rgba(200, 180, 255, 0.08);
  --lg-shadow:        0 2px 8px rgba(60, 40, 110, 0.06),
                      0 8px 32px rgba(60, 40, 110, 0.08);
  --lg-shadow-lg:     0 4px 16px rgba(60, 40, 110, 0.08),
                      0 24px 64px rgba(60, 40, 110, 0.12);
  --lg-shadow-glow:   0 0 24px rgba(138, 43, 226, 0.08),
                      0 0 48px rgba(138, 43, 226, 0.04);
  --lg-radius:        20px;
  --lg-radius-sm:     14px;
  --lg-radius-xs:     10px;
  --lg-radius-pill:   999px;
  --lg-transition:    0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  --lg-transition-fast: 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ── SVG Refraction Filter (inline, referenced by components) ──────────── */
/* This creates the subtle edge distortion effect. Applied via filter: url(#lg-refract) */

/* ── Base Liquid Glass surface ─────────────────────────────────────────── */
.lg-surface {
  background: var(--lg-bg);
  backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturation)) brightness(1.05);
  -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturation)) brightness(1.05);
  border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius);
  box-shadow:
    inset 0 1px 0 var(--lg-specular),
    inset 0 -1px 0 rgba(0,0,0,0.04),
    var(--lg-shadow);
  position: relative;
  overflow: hidden;
  transition: background var(--lg-transition), box-shadow var(--lg-transition), transform var(--lg-transition-fast);
}
.lg-surface::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.25) 0%,
    rgba(255,255,255,0.05) 40%,
    transparent 60%,
    rgba(255,255,255,0.08) 100%
  );
  pointer-events: none;
  z-index: 1;
}

.lg-surface-strong {
  background: var(--lg-bg-active);
  backdrop-filter: blur(var(--lg-blur-strong)) saturate(2) brightness(1.08);
  -webkit-backdrop-filter: blur(var(--lg-blur-strong)) saturate(2) brightness(1.08);
  border: 1px solid var(--lg-border-bright);
  box-shadow:
    inset 0 1px 0 var(--lg-specular),
    inset 0 -1px 0 rgba(0,0,0,0.03),
    var(--lg-shadow-lg);
}

/* ── Liquid Glass Card ─────────────────────────────────────────────────── */
.lg-card {
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.lg-card:hover {
  background: var(--lg-bg-hover);
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 var(--lg-specular),
    var(--lg-shadow-lg);
}
.lg-card__edge-light {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.5) 0%,
    transparent 30%,
    transparent 70%,
    rgba(255,255,255,0.15) 100%
  );
  pointer-events: none;
  z-index: 0;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  padding: 1px;
}

/* ── Liquid Glass Button ───────────────────────────────────────────────── */
.lg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius-pill);
  background: var(--lg-bg);
  backdrop-filter: blur(var(--lg-blur-subtle)) saturate(1.6);
  -webkit-backdrop-filter: blur(var(--lg-blur-subtle)) saturate(1.6);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--lg-transition-fast);
  box-shadow:
    inset 0 1px 0 var(--lg-specular-thin),
    0 1px 4px rgba(60,40,110,0.06);
}
.lg-btn::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.25), transparent);
  border-radius: inherit;
  pointer-events: none;
}
.lg-btn:hover {
  background: var(--lg-bg-hover);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 var(--lg-specular),
    0 4px 16px rgba(60,40,110,0.1);
}
.lg-btn:active {
  transform: translateY(0) scale(0.98);
  background: var(--lg-bg-active);
}
.lg-btn--primary {
  background: linear-gradient(135deg,
    oklch(0.68 0.18 295 / 0.85),
    oklch(0.74 0.13 235 / 0.85));
  color: #fff;
  border-color: rgba(255,255,255,0.2);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    0 2px 8px oklch(0.55 0.18 285 / 0.25),
    var(--lg-shadow-glow);
}
.lg-btn--primary:hover {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.4),
    0 4px 20px oklch(0.55 0.18 285 / 0.35),
    var(--lg-shadow-glow);
}
.lg-btn--dark {
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(var(--lg-blur)) saturate(1.4);
  color: #fff;
  border-color: rgba(255,255,255,0.08);
}
.lg-btn--dark:hover {
  background: rgba(0,0,0,0.8);
}

/* ── Liquid Glass Tab Bar ──────────────────────────────────────────────── */
.lg-tabbar {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: var(--lg-radius);
  background: var(--lg-bg);
  backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturation));
  -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturation));
  border: 1px solid var(--lg-border);
  box-shadow: inset 0 1px 0 var(--lg-specular-thin), var(--lg-shadow);
  position: relative;
}
.lg-tab {
  padding: 8px 18px;
  border-radius: calc(var(--lg-radius) - 4px);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: all var(--lg-transition-fast);
  position: relative;
  z-index: 1;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
}
.lg-tab:hover { color: var(--ink); background: rgba(255,255,255,0.2); }
.lg-tab--active {
  background: rgba(255,255,255,0.6);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(60,40,110,0.08), inset 0 1px 0 rgba(255,255,255,0.5);
  font-weight: 600;
}

/* ── Liquid Glass Pill / Chip ──────────────────────────────────────────── */
.lg-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--lg-radius-pill);
  background: var(--lg-bg);
  backdrop-filter: blur(var(--lg-blur-subtle)) saturate(1.5);
  -webkit-backdrop-filter: blur(var(--lg-blur-subtle)) saturate(1.5);
  border: 1px solid var(--lg-border-subtle);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  box-shadow: inset 0 1px 0 var(--lg-specular-thin);
  transition: all var(--lg-transition-fast);
}
.lg-pill:hover { background: var(--lg-bg-hover); }
.lg-pill__dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}

/* ── Liquid Glass Toggle ───────────────────────────────────────────────── */
.lg-toggle {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: rgba(0,0,0,0.08);
  backdrop-filter: blur(8px);
  border: 1px solid var(--lg-border-subtle);
  cursor: pointer;
  transition: all var(--lg-transition);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}
.lg-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.8);
  transition: transform var(--lg-transition);
}
.lg-toggle--on {
  background: linear-gradient(135deg, oklch(0.68 0.18 295 / 0.8), oklch(0.74 0.13 235 / 0.8));
  border-color: rgba(255,255,255,0.25);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 0 12px oklch(0.68 0.18 295 / 0.15);
}
.lg-toggle--on::after {
  transform: translateX(18px);
  box-shadow: 0 1px 6px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.9);
}

/* ── Liquid Glass Input ────────────────────────────────────────────────── */
.lg-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--lg-border-subtle);
  border-radius: var(--lg-radius-xs);
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(var(--lg-blur-subtle));
  -webkit-backdrop-filter: blur(var(--lg-blur-subtle));
  font-size: 14px;
  color: var(--ink);
  font-family: var(--font-sans);
  transition: all var(--lg-transition-fast);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}
.lg-input::placeholder { color: var(--ink-3); }
.lg-input:focus {
  outline: none;
  border-color: oklch(0.68 0.18 295 / 0.5);
  background: rgba(255,255,255,0.35);
  box-shadow:
    inset 0 1px 2px rgba(0,0,0,0.02),
    0 0 0 3px oklch(0.68 0.18 295 / 0.12),
    var(--lg-shadow-glow);
}

/* ── Liquid Glass Modal / Sheet ────────────────────────────────────────── */
.lg-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.lg-modal {
  width: min(480px, 90vw);
  padding: 28px;
  max-height: 80vh;
  overflow-y: auto;
}

/* ── Liquid Glass Notification ─────────────────────────────────────────── */
.lg-notification {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--lg-radius);
  background: var(--lg-bg);
  backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturation));
  -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturation));
  border: 1px solid var(--lg-border);
  box-shadow: inset 0 1px 0 var(--lg-specular-thin), var(--lg-shadow-lg);
  max-width: 380px;
  position: relative;
  overflow: hidden;
}
.lg-notification::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,0.2), transparent);
  pointer-events: none;
}

/* ── Liquid Glass Sidebar ──────────────────────────────────────────────── */
.lg-sidebar {
  width: 260px;
  height: 100%;
  padding: 18px 14px;
  background: var(--lg-bg);
  backdrop-filter: blur(var(--lg-blur-strong)) saturate(2);
  -webkit-backdrop-filter: blur(var(--lg-blur-strong)) saturate(2);
  border-right: 1px solid var(--lg-border);
  box-shadow: inset -1px 0 0 var(--lg-specular-thin), 4px 0 24px rgba(60,40,110,0.06);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lg-sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--lg-radius-sm);
  font-size: 13px;
  font-weight: 450;
  color: var(--ink-2);
  cursor: pointer;
  transition: all var(--lg-transition-fast);
  border: 1px solid transparent;
  background: transparent;
  font-family: var(--font-sans);
  width: 100%;
  text-align: left;
}
.lg-sidebar-item:hover {
  background: rgba(255,255,255,0.25);
  color: var(--ink);
}
.lg-sidebar-item--active {
  background: rgba(255,255,255,0.45);
  color: var(--ink);
  border-color: var(--lg-border);
  box-shadow: inset 0 1px 0 var(--lg-specular-thin), 0 1px 4px rgba(60,40,110,0.06);
  font-weight: 500;
}

/* ── Liquid Glass Avatar ───────────────────────────────────────────────── */
.lg-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 600;
  position: relative;
  box-shadow:
    0 0 0 2px rgba(255,255,255,0.4),
    0 2px 8px rgba(60,40,110,0.1);
}
.lg-avatar--glass {
  background: var(--lg-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--lg-border);
  color: var(--ink);
}

/* ── Liquid Glass Progress ─────────────────────────────────────────────── */
.lg-progress {
  height: 6px;
  border-radius: var(--lg-radius-pill);
  background: rgba(0,0,0,0.06);
  overflow: hidden;
  position: relative;
}
.lg-progress__fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg,
    oklch(0.68 0.18 295 / 0.8),
    oklch(0.74 0.13 235 / 0.8));
  box-shadow: 0 0 8px oklch(0.68 0.18 295 / 0.25);
  position: relative;
}
.lg-progress__fill::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 20px; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4));
  border-radius: inherit;
}

/* ── Specular Highlight Utility ────────────────────────────────────────── */
.lg-specular-highlight {
  position: absolute;
  top: -50%;
  left: -20%;
  width: 140%;
  height: 100%;
  background: radial-gradient(
    ellipse 60% 50% at 50% 0%,
    rgba(255,255,255,0.15) 0%,
    transparent 70%
  );
  pointer-events: none;
  transform: rotate(-5deg);
}

/* ── Depth layer utility ───────────────────────────────────────────────── */
.lg-depth-1 { z-index: 1; }
.lg-depth-2 { z-index: 2; }
.lg-depth-3 { z-index: 3; }
.lg-controls-layer {
  position: relative;
  z-index: 10;
  /* Controls sit above content — Apple's "distinct functional layer" */
}
