/*
 * GLASSMORPHISM.CSS — Hybrid surface system (April 2026 redesign)
 * Part of Simpler Design System
 *
 * THE RULE: Glass is for transient elements only.
 *   - Persistent surfaces (sidebars, panels, cards, headers) → matte solid
 *   - Transient elements (orb, command palette, toasts, popovers, modal sheets) → premium glass
 *
 * This matches the Linear / Aesop / Mubi register: paper-considered ground floor,
 * glass moments earn their depth precisely because everything else is solid.
 *
 * Recipe references:
 *   - Apple Liquid Glass (specular highlights, saturate 180%, edge refraction)
 *   - Raycast palette (alpha 0.72, blur 50px)
 *   - Granola warm-tinted glass (color-mix toward bg-app)
 *   - Vercel toast (alpha 0.88, barely-glass)
 *
 * BACKWARD COMPATIBILITY: Legacy .glass-card / .glass-panel / .glass-header now
 * render as matte solid. Existing pages don't break — they get cleaner.
 */

/* ===========================================
   PAGE BACKGROUND
   =========================================== */
.glass-page {
    background: var(--bg-app);
}
[data-theme="dark"] .glass-page {
    background: var(--bg-app);
}


/* ===========================================
   PERSISTENT SURFACES — MATTE SOLID
   (was glass-card / glass-panel / glass-header)
   Linear/Aesop register: hairline borders, micro-shadow, no blur.
   =========================================== */

.glass-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all var(--duration-normal, var(--duration-normal)) var(--ease-spring, var(--ease-spring));
}

.glass-card:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.glass-card:active {
    transform: translateY(0);
    transition-duration: var(--duration-micro, var(--duration-micro));
}

[data-theme="dark"] .glass-card {
    background: var(--bg-panel);
    border-color: var(--border-subtle);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] .glass-card:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}


.glass-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

[data-theme="dark"] .glass-panel {
    background: var(--bg-panel);
    border-color: var(--border-subtle);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}


.glass-header {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-subtle);
}

[data-theme="dark"] .glass-header {
    background: var(--bg-panel);
    border-bottom-color: var(--border-subtle);
}


.glass-footer {
    background: var(--bg-panel);
    border-top: 1px solid var(--border-subtle);
}

[data-theme="dark"] .glass-footer {
    background: var(--bg-panel);
    border-top-color: var(--border-subtle);
}


/* ===========================================
   GLASS INPUT GROUPS — solid, like inputs should be
   =========================================== */
.glass-input-group {
    background: var(--bg-app);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid var(--border-subtle);
}

[data-theme="dark"] .glass-input-group {
    background: var(--bg-app);
}


/* ===========================================
   GLASS TABS — solid pill, no blur
   =========================================== */
.glass-tab {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--duration-fast);
}

.glass-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.glass-tab.active {
    color: var(--text-primary);
    background: var(--bg-selected);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .glass-tab.active {
    background: var(--bg-selected);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}


/* ===========================================
   GLASS LIST ITEMS — flat rows
   =========================================== */
.glass-list-item {
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--duration-fast);
}
.glass-list-item:last-child {
    border-bottom: none;
}
.glass-list-item:hover {
    background: var(--bg-hover);
}


/* ===========================================
   GLASS ICON — solid background
   =========================================== */
.glass-icon {
    background: var(--bg-hover);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* ===========================================
   GLASS PROGRESS BARS — solid track
   =========================================== */
.glass-progress-track {
    height: 6px;
    background: var(--bg-hover);
    border-radius: 3px;
    overflow: hidden;
}


/* ===========================================
   GLASS BUTTON — secondary-style, solid
   =========================================== */
.glass-btn {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.glass-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}


/* ===========================================
   GLASS DIVIDER
   =========================================== */
.glass-divider {
    border: none;
    height: 1px;
    background: var(--border-subtle);
    margin: 16px 0;
}


/* ============================================================
   ============================================================
   PREMIUM GLASS — TRANSIENT ELEMENTS ONLY
   ============================================================
   The 5 places real glass earns its place:
     1. .glass-orb     — floating Orb chat panel
     2. .glass-palette — Cmd-K command palette
     3. .glass-toast   — toast notifications
     4. .glass-popover — hover popovers, dropdowns, account switcher
     5. .glass-sheet   — modal sheets overlaying live content

   Each uses the proper specular recipe:
   - color-mix() warm-linen tint (not neutral white)
   - blur + saturate(170-190%) — saturation prevents the muddy gray
   - inset top highlight + bottom shadow (Apple Liquid Glass edge trick)
   - real drop shadow for floating depth
   ============================================================ */


/* —— GLASS POPOVER (medium glass, hover dropdowns/menus) —— */
.glass-popover {
    background: color-mix(in oklab, var(--bg-app) 78%, transparent);
    backdrop-filter: blur(24px) saturate(170%) brightness(1.03);
    -webkit-backdrop-filter: blur(24px) saturate(170%) brightness(1.03);
    border: 1px solid rgba(255, 235, 210, 0.18);
    border-radius: 12px;
    box-shadow:
        inset 0 1px 0 rgba(255, 235, 210, 0.22),
        inset 0 -1px 0 rgba(60, 30, 15, 0.05),
        0 8px 28px rgba(40, 20, 10, 0.10),
        0 2px 6px rgba(40, 20, 10, 0.06);
}

[data-theme="dark"] .glass-popover {
    background: color-mix(in oklab, var(--bg-panel) 70%, transparent);
    backdrop-filter: blur(24px) saturate(180%) brightness(1.08);
    -webkit-backdrop-filter: blur(24px) saturate(180%) brightness(1.08);
    border-color: rgba(255, 220, 195, 0.08);
    box-shadow:
        inset 0 1px 0 rgba(255, 220, 195, 0.10),
        inset 0 -1px 0 rgba(0, 0, 0, 0.18),
        0 12px 36px rgba(0, 0, 0, 0.45),
        0 4px 12px rgba(0, 0, 0, 0.30);
}


/* —— GLASS PALETTE (heavy glass, Raycast Cmd-K) —— */
.glass-palette {
    background: color-mix(in oklab, var(--bg-app) 72%, transparent);
    backdrop-filter: blur(50px) saturate(180%) brightness(1.04);
    -webkit-backdrop-filter: blur(50px) saturate(180%) brightness(1.04);
    border: 1px solid rgba(255, 235, 210, 0.20);
    border-radius: 16px;
    box-shadow:
        inset 0 1px 0 rgba(255, 235, 210, 0.24),
        inset 0 -1px 0 rgba(60, 30, 15, 0.06),
        0 24px 64px rgba(40, 20, 10, 0.16),
        0 8px 20px rgba(40, 20, 10, 0.10);
}

[data-theme="dark"] .glass-palette {
    background: color-mix(in oklab, var(--bg-panel) 64%, transparent);
    backdrop-filter: blur(50px) saturate(190%) brightness(1.10);
    -webkit-backdrop-filter: blur(50px) saturate(190%) brightness(1.10);
    border-color: rgba(255, 220, 195, 0.10);
    box-shadow:
        inset 0 1px 0 rgba(255, 220, 195, 0.12),
        inset 0 -1px 0 rgba(0, 0, 0, 0.22),
        0 32px 80px rgba(0, 0, 0, 0.55),
        0 12px 28px rgba(0, 0, 0, 0.40);
}


/* —— GLASS TOAST (barely-glass, Vercel-style) —— */
.glass-toast {
    background: color-mix(in oklab, var(--bg-panel) 88%, transparent);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid rgba(255, 235, 210, 0.18);
    border-radius: 10px;
    box-shadow:
        inset 0 1px 0 rgba(255, 235, 210, 0.18),
        0 8px 24px rgba(40, 20, 10, 0.12),
        0 2px 4px rgba(40, 20, 10, 0.06);
}

[data-theme="dark"] .glass-toast {
    background: color-mix(in oklab, var(--bg-panel) 86%, transparent);
    backdrop-filter: blur(20px) saturate(170%);
    -webkit-backdrop-filter: blur(20px) saturate(170%);
    border-color: rgba(255, 220, 195, 0.10);
    box-shadow:
        inset 0 1px 0 rgba(255, 220, 195, 0.10),
        0 12px 32px rgba(0, 0, 0, 0.45),
        0 4px 8px rgba(0, 0, 0, 0.25);
}


/* —— GLASS SHEET (modal sheets over live content) —— */
.glass-sheet {
    background: color-mix(in oklab, var(--bg-app) 82%, transparent);
    backdrop-filter: blur(40px) saturate(170%) brightness(1.02);
    -webkit-backdrop-filter: blur(40px) saturate(170%) brightness(1.02);
    border: 1px solid rgba(255, 235, 210, 0.18);
    border-radius: 18px;
    box-shadow:
        inset 0 1px 0 rgba(255, 235, 210, 0.22),
        inset 0 -1px 0 rgba(60, 30, 15, 0.05),
        0 32px 80px rgba(40, 20, 10, 0.18),
        0 12px 28px rgba(40, 20, 10, 0.10);
}

[data-theme="dark"] .glass-sheet {
    background: color-mix(in oklab, var(--bg-panel) 70%, transparent);
    backdrop-filter: blur(40px) saturate(185%) brightness(1.06);
    -webkit-backdrop-filter: blur(40px) saturate(185%) brightness(1.06);
    border-color: rgba(255, 220, 195, 0.10);
    box-shadow:
        inset 0 1px 0 rgba(255, 220, 195, 0.10),
        inset 0 -1px 0 rgba(0, 0, 0, 0.20),
        0 40px 88px rgba(0, 0, 0, 0.55),
        0 16px 32px rgba(0, 0, 0, 0.35);
}


/* —— GLASS ORB (the floating Orb chat panel — heavy + warm-tinted) —— */
.glass-orb {
    background: color-mix(in oklab, var(--bg-app) 70%, transparent);
    backdrop-filter: blur(44px) saturate(180%) brightness(1.04);
    -webkit-backdrop-filter: blur(44px) saturate(180%) brightness(1.04);
    border: 1px solid rgba(204, 115, 97, 0.14);          /* faint rose-copper glass edge */
    border-radius: 18px;
    box-shadow:
        inset 0 1px 0 rgba(255, 235, 210, 0.26),         /* warm top highlight */
        inset 0 -1px 0 rgba(60, 30, 15, 0.06),
        0 0 0 1px rgba(204, 115, 97, 0.04),               /* whisper of brand */
        0 24px 64px rgba(40, 20, 10, 0.14),
        0 8px 20px rgba(40, 20, 10, 0.10);
}

[data-theme="dark"] .glass-orb {
    background: color-mix(in oklab, var(--bg-panel) 60%, transparent);
    backdrop-filter: blur(44px) saturate(195%) brightness(1.10);
    -webkit-backdrop-filter: blur(44px) saturate(195%) brightness(1.10);
    border-color: rgba(204, 115, 97, 0.20);
    box-shadow:
        inset 0 1px 0 rgba(255, 220, 195, 0.12),
        inset 0 -1px 0 rgba(0, 0, 0, 0.22),
        0 0 0 1px rgba(204, 115, 97, 0.06),
        0 32px 72px rgba(0, 0, 0, 0.55),
        0 12px 24px rgba(0, 0, 0, 0.35);
}
