/*
 * Abyss glass for the website: the Gabriel app's finalized dark look (owner's locks, 2026-11-13: dark = Abyss,
 * glow = Signature, labels = sentence, buttons = tactile, glass = on; the font stays Geist as the site has it).
 * Values from gabriel-os branch fable/dark-chat-premium-20261111, commit 11b2fccc (2026-11-13):
 *   app/next/lumen/darkness.css  the Abyss block (ground, raises, line, edge, text, pane, glass fill, specular)
 *   app/next/lumen/tactile.css   the tactile light: raised, key, pressed, well (dark), with Abyss's --lm-t-hi
 *   app/next/lumen/glass.css     blur, the deep sheet, the fallbacks
 *   app/next/lumen/glow.css      the Signature light's static colours (the bloom, for moments of completion)
 *   app/next/lumen/tokens.css    radii and motion; shell.css the focus edge
 * The --lm-* names are the app's, so the two stay recognisable. A change here is a deliberate edit:
 * src/lib/__tests__/abyss-glass-shared.test.ts pins these values.
 *
 * Opt-in: every rule sits under the scope class .ag. The scope itself only defines variables (it paints nothing), so a
 * page restyles a piece by putting .ag on it and using the variables or the .ag-* recipes below. A page that never uses
 * .ag is untouched by this file.
 */

/* ---------- 1. Tokens ---------- */
.ag{
  /* Abyss: the brand's ground, opaque raises (white 3.5 / 5.5 / 7.5% over it), neutral text, jade for state only */
  --lm-ground:#111518;
  --lm-raise-1:#191d20;
  --lm-raise-2:#1e2225;
  --lm-raise-3:#232729;
  --lm-line:#282b2e;
  --lm-edge:#585b5d;
  --lm-edge-focus:#9a9e9f;
  --lm-text-1:#eef0f0;
  --lm-text-2:#afb3b4;
  --lm-text-3:#9a9e9f;
  --lm-accent:#93bba9;
  --lm-glow:rgba(147,187,169,.14);
  --lm-glow-strong:rgba(147,187,169,.26);
  --lm-primary:#eef0f0;
  --lm-primary-ink:#111518;
  --lm-r-control:12px;
  --lm-r-card:16px;
  --lm-r-pill:999px;
  /* Motion */
  --lm-spring:cubic-bezier(.32,.72,0,1);
  --lm-ease-out:cubic-bezier(.2,0,0,1);
  --lm-dur-press:120ms;
  --lm-dur-hover:180ms;
  --lm-dur-fade:200ms;
  --lm-dur-rise:320ms;
  --lm-dur-sheet:420ms;
  --lm-press-scale:.97;
  --lm-press-scale-wide:.98;
  /* The pane: a specular top edge and a faint inner sheen (inset light only, never an outer shadow) */
  --lm-spec:rgb(255 255 255/.16);
  --lm-spec-ctl:rgb(255 255 255/.14);
  --lm-sheen:rgb(255 255 255/.03);
  --lm-pane:inset 0 1px 0 var(--lm-spec),inset 0 22px 22px -22px var(--lm-sheen);
  --lm-pane-ring:inset 0 1px 0 var(--lm-spec),inset 0 0 0 1px var(--lm-line),inset 0 22px 22px -22px var(--lm-sheen);
  /* Glass, for floating pieces only (sheets, pills, a stuck bar), never a list, row or card */
  /* The app writes these as color-mix(in srgb,var(--lm-raise-1) 62%,transparent) and color-mix(in srgb,var(--lm-ground) 74%,
     transparent). Mixing a colour with transparent keeps the colour and scales its alpha, so they are raise-1 #191d20
     (25 29 32) at .62 and the ground #111518 (17 21 24) at .74, written plainly so a browser with blur but no color-mix()
     still gets the tinted sheet, not a clear one. */
  --lm-g-fill:rgb(25 29 32/.62);
  --lm-g-fill-deep:rgb(17 21 24/.74);
  --lm-g-spec:var(--lm-spec-ctl);
  --lm-g-line:rgb(255 255 255/.09);
  --lm-g-light:radial-gradient(70% 60% at 50% 0%,rgb(255 255 255/.03),rgb(255 255 255/0) 100%);
  --lm-g-blur:blur(20px) saturate(140%);
  /* Tactile (dark), with Abyss's top light */
  --lm-t-hi:var(--lm-spec-ctl);
  --lm-t-lo:rgb(0 0 0/.6);
  --lm-t-sheen:linear-gradient(rgb(255 255 255/.035),rgb(255 255 255/0) 80%);
  --lm-t-press:rgb(0 0 0/.75);
  --lm-t-well:rgb(0 0 0/.62);
  --lm-t-lip:rgb(255 255 255/.08);
  --lm-t-glow:rgb(255 255 255/.06);
  --lm-t-shade:rgb(0 0 0/.35);
  --lm-t-press-wide:rgb(0 0 0/.45);
  --lm-t-well-wide:rgb(0 0 0/.4);
  --lm-tp-glow:rgb(255 255 255/.5);
  --lm-tp-shade:rgb(17 21 24/.14);
  --lm-tp-hi:rgb(255 255 255/.95);
  --lm-tp-lo:rgb(17 21 24/.34);
  --lm-tp-sheen:linear-gradient(rgb(255 255 255/.7),rgb(255 255 255/0) 80%);
  --lm-tp-press:rgb(17 21 24/.45);
  --lm-t-raised:inset 0 1px 0 var(--lm-t-hi),inset 0 10px 14px -10px var(--lm-t-glow),inset 0 -1px 0 var(--lm-t-lo),inset 0 -8px 12px -8px var(--lm-t-shade);
  --lm-t-key:inset 0 1px 0 var(--lm-tp-hi),inset 0 10px 14px -10px var(--lm-tp-glow),inset 0 -1px 0 var(--lm-tp-lo),inset 0 -8px 12px -8px var(--lm-tp-shade);
  --lm-t-pressed:inset 0 2px 4px var(--lm-t-press),inset 0 8px 12px -6px var(--lm-t-press-wide),inset 0 -1px 0 rgb(0 0 0/0),inset 0 0 0 rgb(0 0 0/0);
  --lm-t-key-pressed:inset 0 2px 4px var(--lm-tp-press),inset 0 8px 12px -6px var(--lm-tp-press),inset 0 -1px 0 rgb(0 0 0/0),inset 0 0 0 rgb(0 0 0/0);
  --lm-t-sunk:inset 0 2px 4px var(--lm-t-well),inset 0 8px 12px -6px var(--lm-t-well-wide),inset 0 -1px 0 var(--lm-t-lip),inset 0 0 0 rgb(0 0 0/0);
  /* A chosen chip: the 1px jade ring and the 3px glow ring (tactile.css line 106, Mind's chosen answer) */
  --lm-chosen:inset 0 0 0 1px var(--lm-accent),0 0 0 3px var(--lm-glow);
  /* Signature light, still: the launch moment's light (glow.css line 64, .lm-launch-light, with its dark alphas from
     line 65: core .2, mid .13, outer .05) and the Signature palette (line 49): a white core through teal to jade-mint.
     Never behind reading text; for a moment of completion only. */
  --lm-sig-bloom:radial-gradient(closest-side,rgb(255 255 255/.2),rgb(84 204 219/.13) 30%,rgb(115 224 184/.05) 62%,rgb(115 224 184/0) 100%);
}

/* ---------- 2. Recipes (each only where a page puts the class, inside .ag) ---------- */
/* A pane: cards. Opaque raise, hairline, specular top edge. */
.ag .ag-pane,.ag.ag-pane{background-color:var(--lm-raise-1);border:1px solid var(--lm-line);border-radius:var(--lm-r-card);box-shadow:var(--lm-pane);color:var(--lm-text-1)}
/* Glass: a floating piece; the deep version is a sheet. */
.ag .ag-glass,.ag.ag-glass{background-color:var(--lm-g-fill);background-image:var(--lm-g-light);border:1px solid var(--lm-g-line);box-shadow:inset 0 1px 0 var(--lm-g-spec);-webkit-backdrop-filter:var(--lm-g-blur);backdrop-filter:var(--lm-g-blur)}
.ag .ag-glass-deep,.ag.ag-glass-deep{background-color:var(--lm-g-fill-deep);background-image:var(--lm-g-light);border:1px solid var(--lm-g-line);box-shadow:inset 0 1px 0 var(--lm-g-spec);-webkit-backdrop-filter:var(--lm-g-blur);backdrop-filter:var(--lm-g-blur)}
/* A well: inputs and selects, pressed into the surface. */
.ag .ag-well{background-color:var(--lm-ground);border:1px solid var(--lm-line);border-radius:var(--lm-r-control);box-shadow:var(--lm-t-sunk);color:var(--lm-text-1)}
.ag .ag-well:focus,.ag .ag-well:focus-visible{border-color:var(--lm-edge-focus);outline:none}
/* A raised chip or tile; chosen keeps the raise and adds a 1px jade ring; pressed debosses. */
.ag .ag-chip{background-color:var(--lm-raise-2);background-image:var(--lm-t-sheen);border:0;border-radius:var(--lm-r-control);box-shadow:var(--lm-t-raised),inset 0 0 0 1px var(--lm-line);color:var(--lm-text-2);transition:box-shadow var(--lm-dur-hover) var(--lm-spring),color var(--lm-dur-hover) var(--lm-spring),translate var(--lm-dur-fade) var(--lm-spring),scale var(--lm-dur-fade) var(--lm-spring)}
.ag .ag-chip:is([aria-pressed=true],[aria-checked=true],:has(input:checked)){box-shadow:var(--lm-t-raised),var(--lm-chosen);color:var(--lm-text-1)}
.ag .ag-chip:active{background-image:none;box-shadow:var(--lm-t-pressed),inset 0 0 0 1px var(--lm-line);translate:0 1px;scale:var(--lm-press-scale);transition:box-shadow var(--lm-dur-press) var(--lm-ease-out),translate var(--lm-dur-press) var(--lm-ease-out),scale var(--lm-dur-press) var(--lm-ease-out)}
/* The pearl key (primary) and the raised secondary key. */
.ag .ag-key{background-color:var(--lm-primary);background-image:var(--lm-tp-sheen);border:0;color:var(--lm-primary-ink);box-shadow:var(--lm-t-key)}
.ag .ag-key:active{background-image:none;box-shadow:var(--lm-t-key-pressed);translate:0 1px;scale:var(--lm-press-scale)}
.ag .ag-key-2{background-color:var(--lm-raise-2);background-image:var(--lm-t-sheen);border:0;color:var(--lm-text-1);box-shadow:var(--lm-t-raised),inset 0 0 0 1px var(--lm-line)}
.ag .ag-key-2:active{background-image:none;box-shadow:var(--lm-t-pressed),inset 0 0 0 1px var(--lm-line);translate:0 1px;scale:var(--lm-press-scale-wide)}
/* Focus: one quiet edge. */
.ag .ag-focus:focus-visible,.ag :is(.ag-chip,.ag-key,.ag-key-2):focus-visible{outline:1px solid var(--lm-edge-focus);outline-offset:2px}
/* The Signature bloom, still and small. */
.ag .ag-bloom{background:var(--lm-sig-bloom);pointer-events:none}

/* ---------- 3. Fallbacks: reduced transparency, more contrast, no backdrop-filter → solid fills, no blur ---------- */
@media (prefers-reduced-transparency:reduce),(prefers-contrast:more){
  .ag{--lm-g-fill:var(--lm-raise-2);--lm-g-fill-deep:var(--lm-ground);--lm-g-blur:none}
}
@supports not ((-webkit-backdrop-filter:blur(1px)) or (backdrop-filter:blur(1px))){
  .ag{--lm-g-fill:var(--lm-raise-2);--lm-g-fill-deep:var(--lm-ground)}
}
@media (prefers-reduced-motion:reduce){
  .ag{--lm-dur-press:0ms;--lm-dur-hover:0ms;--lm-dur-fade:0ms;--lm-dur-rise:0ms;--lm-dur-sheet:0ms;--lm-press-scale:1;--lm-press-scale-wide:1}
  /* Nothing moves: no press nudge either (tactile.css line 220) */
  .ag :active,.ag:active{translate:none!important}
}
/* Forced colours (Windows High Contrast): the system draws everything. Glass becomes the solid Canvas (no blur), every
   control gets a real border (the tactile edges are box-shadows, which the system drops), a chosen chip is Highlight,
   wells keep a border, and focus stays visible. */
@media (forced-colors:active){
  .ag,.ag *{-webkit-backdrop-filter:none!important;backdrop-filter:none!important}
  .ag,.ag :not(select){background-image:none!important}
  .ag{--lm-g-fill:Canvas;--lm-g-fill-deep:Canvas}
  .ag .ag-glass,.ag .ag-glass-deep,.ag.ag-glass,.ag.ag-glass-deep{background-color:Canvas;color:CanvasText;border-color:CanvasText}
  .ag .ag-chip,.ag .ag-key,.ag .ag-key-2{border:1px solid ButtonText}
  .ag .ag-chip:is([aria-pressed=true],[aria-checked=true],:has(input:checked)){forced-color-adjust:none;border-color:Highlight;background-color:Highlight;color:HighlightText;box-shadow:none}
  .ag .ag-well{border:1px solid CanvasText}
  .ag :focus-visible{outline:2px solid Highlight!important;outline-offset:2px}
}
