/* ═══════════════════════════════════════════════════════════════════════════
   Webly Liquid Glass — the shared theme of Webly products (v1.1: glass buttons, focus ring)
   Source of truth: global/themes/webly-liquid-glass/. Each product keeps its own
   copy of this file (so products stay independent) and uses the wlg-* classes.
   Values are the Webly dashboard's (css/site.css) so every product looks the same.

   Needs, on <html>: data-theme="dark" | "light"   (dark is the default)
   Needs the lens filter once per page: webly-liquid-glass.js  (Chromium refracts,
   Safari/Firefox fall back to frost + rim light automatically).

   Parts:  tokens · .wlg-glass / .wlg-card · .wlg-icon-btn · .wlg-btn (+primary, danger)
           .wlg-seg · .wlg-chip · .wlg-pill · .wlg-field · .wlg-label · .wlg-title
           .wlg-rows (card with divided rows) · .wlg-menu
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── tokens ─────────────────────────────────────────────────────────────── */
:root {
  --wlg-accent: #CFFA3A;
  --wlg-accent-ink: #060606;                       /* text on the lime button */
  --wlg-accent-grad: linear-gradient(135deg, #CFFA3A 0%, #DFFF5B 100%);
  --wlg-accent-soft: rgba(207, 250, 58, 0.16);     /* selected tint */
  --wlg-ink: #FFFFFF;
  --wlg-text-2: rgba(255, 255, 255, 0.6);
  --wlg-text-3: rgba(255, 255, 255, 0.4);
  --wlg-label: #BBBBBB;
  --wlg-line: rgba(255, 255, 255, 0.08);
  --wlg-line-strong: rgba(255, 255, 255, 0.16);
  --wlg-row: rgba(255, 255, 255, 0.04);            /* quiet fill of things inside a card */
  --wlg-track: rgba(255, 255, 255, 0.07);          /* groove of a segmented control */
  --wlg-ok: #34D399;
  --wlg-warn: #F5A524;
  --wlg-bad: #FF6B6B;
  --wlg-danger: #FF8E8E;
  --wlg-danger-line: rgba(255, 107, 107, 0.45);
  --wlg-radius: 16px;
  --wlg-glass: rgba(22, 23, 28, 0.32);
  --wlg-glass-solid: rgba(14, 15, 18, 0.92);       /* menus that must stay readable */
  --wlg-rim:
    inset 1.5px 1.5px 0 -0.5px rgba(255, 255, 255, 0.55),
    inset -1px -1px 0 -0.5px rgba(255, 255, 255, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.10);
  --wlg-shadow-card: inset 0 0 22px rgba(255, 255, 255, 0.06), 0 18px 50px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.25);
  --wlg-shadow-small: inset 0 0 8px rgba(255, 255, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.35);
  --wlg-sheen: radial-gradient(120% 60% at 15% 0%, rgba(255, 255, 255, 0.12), transparent 55%), radial-gradient(90% 50% at 100% 100%, rgba(255, 255, 255, 0.05), transparent 60%);
  --wlg-sheen-blend: screen;
}

:root[data-theme="light"] {
  --wlg-accent: #4A6300;                           /* the lime as readable text on white */
  --wlg-accent-soft: rgba(207, 250, 58, 0.34);
  --wlg-ink: #111111;
  --wlg-text-2: #555555;
  --wlg-text-3: #888888;
  --wlg-label: #666666;
  --wlg-line: rgba(0, 0, 0, 0.08);
  --wlg-line-strong: rgba(0, 0, 0, 0.2);
  --wlg-row: rgba(0, 0, 0, 0.035);
  --wlg-track: rgba(0, 0, 0, 0.06);
  --wlg-danger: #D63031;
  --wlg-danger-line: rgba(214, 48, 49, 0.45);
  --wlg-glass: transparent;
  --wlg-glass-solid: rgba(255, 255, 255, 0.96);
  --wlg-rim:
    inset 1.5px 1.5px 0 -0.5px rgba(255, 255, 255, 1),
    inset -1px -1px 0 -0.5px rgba(255, 255, 255, 0.8),
    inset 0 0 0 1px rgba(0, 0, 0, 0.09);
  --wlg-shadow-card: inset 0 -12px 24px rgba(0, 0, 0, 0.025), 0 18px 44px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.05);
  --wlg-shadow-small: 0 4px 12px rgba(0, 0, 0, 0.12);
  --wlg-sheen: linear-gradient(135deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.12) 32%, rgba(255, 255, 255, 0) 55%);
  --wlg-sheen-blend: normal;
}

/* ── the material: Real Liquid Glass (global/effects/real-liquid-glass.md) ── */
.wlg-glass,
.wlg-card {
  position: relative;
  isolation: isolate;
  border: none;
  background: var(--wlg-glass);
  backdrop-filter: blur(7px) saturate(170%) brightness(1.05);
  backdrop-filter: url(#liquid-lens) blur(7px) saturate(170%) brightness(1.05);
  -webkit-backdrop-filter: blur(12px) saturate(170%) brightness(1.05);
  box-shadow: var(--wlg-rim), var(--wlg-shadow-card);
}
:root[data-theme="light"] .wlg-glass,
:root[data-theme="light"] .wlg-card {
  backdrop-filter: blur(4px) saturate(140%);
  backdrop-filter: url(#liquid-lens) blur(4px) saturate(140%);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
}
.wlg-card { border-radius: var(--wlg-radius); }

/* light catching the glass, under the content */
.wlg-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
  background: var(--wlg-sheen);
  mix-blend-mode: var(--wlg-sheen-blend);
}

/* a card of divided rows (lists, settings, forms) */
.wlg-rows { overflow: hidden; }
.wlg-rows > * + * { border-top: 1px solid var(--wlg-line); }

/* a pop-over menu: glass, but solid enough to read */
.wlg-menu {
  border-radius: var(--wlg-radius);
  background: var(--wlg-glass-solid);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  backdrop-filter: blur(20px) saturate(170%);
  box-shadow: var(--wlg-rim), 0 18px 40px rgba(0, 0, 0, 0.35);
}

/* ── round icon button (header icons) and the same glass as a pill ──────── */
.wlg-icon-btn {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  color: #D4D4D8;
  background: var(--wlg-glass);
  backdrop-filter: blur(7px) saturate(170%) brightness(1.05);
  backdrop-filter: url(#liquid-lens) blur(7px) saturate(170%) brightness(1.05);
  -webkit-backdrop-filter: blur(12px) saturate(170%) brightness(1.05);
  box-shadow: var(--wlg-rim), var(--wlg-shadow-small);
  cursor: pointer;
  transition: transform 260ms cubic-bezier(0.3, 1.4, 0.5, 1), background 200ms ease, box-shadow 220ms ease;
}
.wlg-icon-btn--pill { width: auto; padding: 0 11px 0 8px; border-radius: 999px; gap: 8px; }
.wlg-icon-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(120% 70% at 25% 0%, rgba(255, 255, 255, 0.28), transparent 60%);
  mix-blend-mode: screen;
}
.wlg-icon-btn > * { position: relative; z-index: 1; }
.wlg-icon-btn:active { transform: scale(0.94); background: rgba(207, 250, 58, 0.12); color: #FFFFFF; }
:root[data-theme="light"] .wlg-icon-btn { color: #111111; background: rgba(255, 255, 255, 0.6); box-shadow: var(--wlg-rim), var(--wlg-shadow-small); }
:root[data-theme="light"] .wlg-icon-btn:active { background: rgba(255, 255, 255, 0.85); color: #000000; }
@media (hover: hover) {
  .wlg-icon-btn:hover { transform: scale(1.08); background: rgba(207, 250, 58, 0.12); color: #FFFFFF; }
  :root[data-theme="light"] .wlg-icon-btn:hover { transform: translateY(-1px) scale(1.06); background: rgba(255, 255, 255, 0.85); color: #000000; }
}

/* ── buttons: the same clear glass as the cards (rim light, sheen), 14px;
      a form's own action is the lime one, a destructive one has red text and a red rim ── */
.wlg-btn {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 1.2rem;
  border: none;
  border-radius: 14px;
  background: var(--wlg-glass);
  backdrop-filter: blur(7px) saturate(170%) brightness(1.05);
  backdrop-filter: url(#liquid-lens) blur(7px) saturate(170%) brightness(1.05);
  -webkit-backdrop-filter: blur(12px) saturate(170%) brightness(1.05);
  box-shadow: var(--wlg-rim), var(--wlg-shadow-small);
  color: var(--wlg-ink);
  font: 600 0.8125rem 'Inter', 'Segoe UI', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, filter 0.2s ease;
}
:root[data-theme="light"] .wlg-btn {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(4px) saturate(140%);
  backdrop-filter: url(#liquid-lens) blur(4px) saturate(140%);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
}
/* light catching the glass, under the text */
.wlg-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
  background: var(--wlg-sheen);
  mix-blend-mode: var(--wlg-sheen-blend);
}
.wlg-btn:active { transform: scale(0.98); color: var(--wlg-accent); }
@media (hover: hover) { .wlg-btn:hover { transform: translateY(-1px); color: var(--wlg-accent); } }
:root[data-theme="light"] .wlg-btn--primary,
.wlg-btn--primary {
  background: var(--wlg-accent-grad);
  color: var(--wlg-accent-ink);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: inset 1.5px 1.5px 0 -0.5px rgba(255, 255, 255, 0.7), inset 0 0 0 1px rgba(0, 0, 0, 0.06), 0 12px 32px rgba(0, 0, 0, 0.18);
}
.wlg-btn--primary:active { color: var(--wlg-accent-ink); filter: brightness(1.05); }
@media (hover: hover) { .wlg-btn--primary:hover { color: var(--wlg-accent-ink); filter: brightness(1.05); } }
.wlg-btn--danger {
  color: var(--wlg-danger);
  box-shadow:
    inset 1.5px 1.5px 0 -0.5px rgba(255, 170, 170, 0.5),
    inset -1px -1px 0 -0.5px rgba(255, 107, 107, 0.25),
    inset 0 0 0 1px var(--wlg-danger-line),
    var(--wlg-shadow-small);
}
:root[data-theme="light"] .wlg-btn--danger {
  box-shadow:
    inset 1.5px 1.5px 0 -0.5px rgba(255, 255, 255, 1),
    inset 0 0 0 1px var(--wlg-danger-line),
    var(--wlg-shadow-small);
}
.wlg-btn--danger:active { color: var(--wlg-danger); background: rgba(255, 107, 107, 0.1); }
@media (hover: hover) { .wlg-btn--danger:hover { color: var(--wlg-danger); background: rgba(255, 107, 107, 0.08); } }

/* keyboard focus: one lime ring on everything that can be pressed */
.wlg-btn:focus-visible,
.wlg-icon-btn:focus-visible,
.wlg-chip:focus-visible { outline: 2px solid var(--wlg-accent); outline-offset: 2px; }
.wlg-seg > button:focus-visible { outline: 2px solid var(--wlg-accent); outline-offset: -2px; }   /* inside: the pill clips */

/* ── segmented control: the bottom menu's glass pill with a sliding, squeezing bubble ──
   Markup: <div class="wlg-seg" data-wlg-key="id"><button aria-selected="true">…</button>…</div>
   webly-liquid-glass.js adds the bubble and moves it (WeblyGlass.enhanceAll after rendering).
   Selected = aria-selected / aria-checked / aria-pressed = "true" or class is-on.
   Status tones: give a button wlg-seg__available | wlg-seg__reserved | wlg-seg__sold. */
.wlg-seg {
  position: relative;
  isolation: isolate;
  display: flex;
  gap: 0;
  padding: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: transparent;                         /* fully clear: only the glass itself */
  backdrop-filter: blur(7px) saturate(170%) brightness(1.05);
  backdrop-filter: url(#liquid-lens) blur(7px) saturate(170%) brightness(1.05);
  -webkit-backdrop-filter: blur(12px) saturate(170%) brightness(1.05);
  box-shadow:
    inset 1.5px 1.5px 0 -0.5px rgba(255, 255, 255, 0.55),
    inset -1px -1px 0 -0.5px rgba(255, 255, 255, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.10),
    inset 0 0 18px rgba(255, 255, 255, 0.05),
    0 6px 20px rgba(0, 0, 0, 0.35);
}
:root[data-theme="light"] .wlg-seg {
  backdrop-filter: blur(4px) saturate(140%);
  backdrop-filter: url(#liquid-lens) blur(4px) saturate(140%);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
  box-shadow:
    inset 1.5px 1.5px 0 -0.5px rgba(255, 255, 255, 0.95),
    inset -1px -1px 0 -0.5px rgba(255, 255, 255, 0.6),
    inset 0 0 0 1px rgba(0, 0, 0, 0.06),
    0 6px 20px rgba(0, 0, 0, 0.1);
}
.wlg-seg > button {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--wlg-text-2);
  font: 600 0.875rem 'Inter', 'Segoe UI', sans-serif;
  white-space: nowrap;
  cursor: pointer;
  transition: color 200ms ease;
  -webkit-tap-highlight-color: transparent;
}
.wlg-seg > button[aria-selected="true"], .wlg-seg > button[aria-checked="true"], .wlg-seg > button[aria-pressed="true"], .wlg-seg > button.is-on { color: var(--wlg-accent); }
.wlg-seg > .wlg-seg__available[aria-selected="true"], .wlg-seg > .wlg-seg__available[aria-checked="true"] { color: var(--wlg-ok); }
.wlg-seg > .wlg-seg__reserved[aria-selected="true"], .wlg-seg > .wlg-seg__reserved[aria-checked="true"] { color: var(--wlg-warn); }
.wlg-seg > .wlg-seg__sold[aria-selected="true"], .wlg-seg > .wlg-seg__sold[aria-checked="true"] { color: var(--wlg-bad); }

/* more choices than fit: the pill scrolls sideways */
.wlg-seg--scroll { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.wlg-seg--scroll::-webkit-scrollbar { display: none; }
.wlg-seg--scroll > button { flex: 0 0 auto; }

/* the bubble: lime-tinted glass that stretches from choice to choice */
.wlg-seg__bubble {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  right: 4px;
  z-index: 0;
  border-radius: 999px;
  pointer-events: none;
  background: var(--wlg-bubble, rgba(207, 250, 58, 0.14));
  box-shadow:
    inset 1px 1px 0 -0.5px rgba(255, 255, 255, 0.45),
    inset 0 0 0 1px var(--wlg-bubble-line, rgba(207, 250, 58, 0.22)),
    0 4px 14px var(--wlg-bubble-glow, rgba(207, 250, 58, 0.12));
  opacity: 0;
  transition:
    left 420ms cubic-bezier(0.3, 1.25, 0.5, 1) var(--lead-l, 0ms),
    right 420ms cubic-bezier(0.3, 1.25, 0.5, 1) var(--lead-r, 0ms),
    transform 200ms ease,
    opacity 200ms ease,
    background 250ms ease,
    box-shadow 250ms ease;
}
/* squeezes thinner while it is stretched between two choices */
.wlg-seg__bubble.is-moving { transform: scaleY(0.8); }
:root[data-theme="light"] .wlg-seg { --wlg-bubble: rgba(207, 250, 58, 0.45); --wlg-bubble-line: rgba(0, 0, 0, 0.06); --wlg-bubble-glow: rgba(120, 160, 20, 0.18); }
.wlg-seg[data-tone="available"] { --wlg-bubble: rgba(52, 211, 153, 0.18); --wlg-bubble-line: rgba(52, 211, 153, 0.38); --wlg-bubble-glow: rgba(52, 211, 153, 0.14); }
.wlg-seg[data-tone="reserved"] { --wlg-bubble: rgba(245, 165, 36, 0.18); --wlg-bubble-line: rgba(245, 165, 36, 0.38); --wlg-bubble-glow: rgba(245, 165, 36, 0.14); }
.wlg-seg[data-tone="sold"] { --wlg-bubble: rgba(255, 107, 107, 0.18); --wlg-bubble-line: rgba(255, 107, 107, 0.38); --wlg-bubble-glow: rgba(255, 107, 107, 0.14); }
/* without the script (no bubble) the selected choice carries the tint itself */
.wlg-seg:not(.is-live) > button[aria-selected="true"], .wlg-seg:not(.is-live) > button[aria-checked="true"], .wlg-seg:not(.is-live) > button[aria-pressed="true"], .wlg-seg:not(.is-live) > button.is-on { background: var(--wlg-accent-soft); }

@media (prefers-reduced-motion: reduce) {
  .wlg-seg__bubble { transition: opacity 150ms ease !important; }
  .wlg-seg__bubble.is-moving { transform: none; }
}

/* ── chip (filter pill) and status pill ─────────────────────────────────── */
.wlg-chip { flex: 0 0 auto; padding: 7px 14px; border: 1px solid var(--wlg-line); border-radius: 999px; background: none; color: var(--wlg-text-2); font: 500 0.875rem 'Inter', 'Segoe UI', sans-serif; cursor: pointer; }
.wlg-chip.is-on { border-color: transparent; background: var(--wlg-accent-soft); color: var(--wlg-accent); }
.wlg-pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font: 600 0.75rem 'Inter', 'Segoe UI', sans-serif; white-space: nowrap; }
.wlg-pill--ok { color: var(--wlg-ok); background: rgba(52, 211, 153, 0.14); }
.wlg-pill--warn { color: var(--wlg-warn); background: rgba(245, 165, 36, 0.14); }
.wlg-pill--bad { color: var(--wlg-bad); background: rgba(255, 107, 107, 0.14); }

/* ── fields and labels ──────────────────────────────────────────────────── */
.wlg-field {
  width: 100%;
  min-height: 48px;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--wlg-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--wlg-ink);
  font: 400 1rem 'Inter', 'Segoe UI', sans-serif;      /* 16px: iPhone does not zoom in */
}
:root[data-theme="light"] .wlg-field { border-color: rgba(0, 0, 0, 0.12); background: rgba(0, 0, 0, 0.03); }
.wlg-field:focus { outline: none; border-color: rgba(207, 250, 58, 0.6); box-shadow: none; }
:root[data-theme="light"] .wlg-field:focus { border-color: var(--wlg-accent); }
.wlg-field::placeholder { color: var(--wlg-text-3); }

.wlg-label { font: 600 0.75rem 'Inter', 'Segoe UI', sans-serif; letter-spacing: 0.15em; text-transform: uppercase; color: var(--wlg-label); }
.wlg-title { font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 900; line-height: 1.1; letter-spacing: -0.04em; color: var(--wlg-ink); }

/* Georgian has no capitals: never force upper case there */
:root[data-lang="ka"] .wlg-label,
:root[data-lang="ka"] .wlg-btn { text-transform: none; letter-spacing: 0.02em; }

@media (prefers-reduced-motion: reduce) {
  .wlg-icon-btn, .wlg-btn { transition: none; }
}
