/* ============================================
   Liquid Glass Effect System
   Core: Specular Rim Light Highlight
   Ref: Apple Liquid Glass (WWDC 2025)
   ============================================

   Usage: add class="liquid-glass" to any container.
   Requires: background, border-radius set on the element.

   1. CSS ::before — radial gradient rim light (fresnel edge)
   2. CSS ::after  — inset box-shadow inner edge catch
   3. backdrop-filter: blur() for frosted glass
   ============================================ */

/* ── Generic Liquid Glass ── */
.liquid-glass {
  position: relative;
  overflow: hidden;
  background-color: var(--glass-bg);
  background-image: linear-gradient(135deg, var(--glass-tint), transparent 60%);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  box-shadow: var(--glass-shadow), var(--glass-inner-shadow);
}

.liquid-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  opacity: 0.6;
  transition: opacity .3s ease;
  background:
    radial-gradient(ellipse 50% 35% at 12% 8%, rgba(255,255,255,0.03), transparent 65%),
    linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 25%),
    linear-gradient(90deg, rgba(255,255,255,0.025) 0%, transparent 15%);
}

.liquid-glass::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  transition: box-shadow .3s ease;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.16),
    inset 1px 0 0 rgba(255,255,255,0.08),
    inset 0 -1px 0 rgba(0,0,0,0.10),
    inset -1px 0 0 rgba(0,0,0,0.05);
}

/* ── Light Theme — dark rim on light glass ── */
[data-theme="light"] .liquid-glass::before {
  background:
    radial-gradient(ellipse 50% 35% at 12% 8%, rgba(0,0,0,0.05), transparent 65%),
    linear-gradient(180deg, rgba(0,0,0,0.02) 0%, transparent 25%),
    linear-gradient(90deg, rgba(0,0,0,0.03) 0%, transparent 15%)
}

[data-theme="light"] .liquid-glass::after {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.90),
    inset 1px 0 0 rgba(255,255,255,0.50),
    inset 0 -1px 0 rgba(0,0,0,0.12),
    inset -1px 0 0 rgba(0,0,0,0.08);
}

/* ── Hover ── */
.liquid-glass:hover::before {
  opacity: 1;
}

.liquid-glass:hover::after {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    inset 1px 0 0 rgba(255,255,255,0.12),
    inset 0 -1px 0 rgba(0,0,0,0.14),
    inset -1px 0 0 rgba(0,0,0,0.08);
}

[data-theme="light"] .liquid-glass:hover::after {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.95),
    inset 1px 0 0 rgba(255,255,255,0.60),
    inset 0 -1px 0 rgba(0,0,0,0.18),
    inset -1px 0 0 rgba(0,0,0,0.12);
}

/* ── Header — frosted glass ── */
.glass-header {
  background: color-mix(in srgb, var(--color-bg-primary) 70%, transparent);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  border-bottom: 1px solid var(--color-border);
  position: relative;
  box-shadow: none;
}

/* accent hairline */
.glass-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, var(--color-brand-yellow) 30%, var(--color-brand-accent) 70%, transparent 100%);
  opacity: 0.45;
}

/* ── Footer — always dark, force dark-mode glass ── */
[data-theme="light"] .footer .liquid-glass {
  background-color: rgba(255, 255, 255, 0.07);
}

[data-theme="light"] .footer .liquid-glass::before {
  background:
    radial-gradient(ellipse 50% 35% at 12% 8%, rgba(255,255,255,0.03), transparent 65%),
    linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 25%),
    linear-gradient(90deg, rgba(255,255,255,0.025) 0%, transparent 15%);
}

[data-theme="light"] .footer .liquid-glass::after {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.16),
    inset 1px 0 0 rgba(255,255,255,0.08),
    inset 0 -1px 0 rgba(0,0,0,0.10),
    inset -1px 0 0 rgba(0,0,0,0.05);
}

[data-theme="light"] .footer .liquid-glass:hover::after {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    inset 1px 0 0 rgba(255,255,255,0.12),
    inset 0 -1px 0 rgba(0,0,0,0.14),
    inset -1px 0 0 rgba(0,0,0,0.08);
}

/* ── Glass Input ── */
.glass-input {
  background: var(--color-input-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  color: var(--color-text-primary);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  width: 100%;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.glass-input::placeholder {
  color: var(--color-input-placeholder);
}

.glass-input:focus {
  border-color: var(--color-input-focus-border);
  box-shadow: 0 0 0 3px rgba(248, 215, 72, 0.15), inset 0 1px 0 rgba(255,255,255,0.10);
}
