@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ==========================================================================
   WGG - signed-in shell
   Companion to glass-auth.css, which dresses the gate. This dresses what is
   behind it, so the two read as one product: same display face, same mono
   meta, same brand light.

   Glass and soft-UI have separate jobs here, deliberately
   -------------------------------------------------------
   They undo each other if both are applied to everything: soft-UI needs an
   opaque mid-tone surface for its twin shadows to read as extrusion, and
   glass needs depth behind it to refract. So:

     glass    - the chrome that floats OVER content: the sticky bar, the
                dialog, the sheet that covers the page
     soft-UI  - the surfaces you PRESS: module tiles, buttons, fields, pills

   The extrusion carries meaning rather than decoration: a module you can
   open stands proud of the page, a module you cannot is sunk into it. That
   is the state, read before the label is.

   Soft-UI's known failure is contrast - everything melts into the background.
   Text here stays at full strength, and focus is a visible ring rather than a
   shadow, because a shadow is exactly what a soft-UI focus state loses.

   How a page opts in
   ------------------
   <link rel="stylesheet" href="/shared/wgg-shell.css">
   .wgg-shell     the signed-in wrapper (paints the canvas)
   .shell-bar     the sticky top bar
   .shell-nav     a nav pill inside the bar
   .shell-tile    a module tile          (.is-locked for no access)
   .shell-chip    the icon plate on a tile
   .shell-badge   the role pill
   .shell-panel   a raised panel - tables, blocks of content
   .shell-dialog  a glass dialog over the page
   ========================================================================== */

.wgg-shell {
    --s-canvas: #e9eef7;
    --s-raise-a: #fcfdff;
    --s-raise-b: #dde5f2;

    --s-dark: rgb(13 38 76 / .17);
    --s-dark-soft: rgb(13 38 76 / .08);
    --s-light: rgb(255 255 255 / .95);

    --s-ink: #0f172a;
    --s-dim: #51637f;
    --s-faint: #76869f;
    --s-hair: rgb(13 38 76 / .10);

    --s-brand: #00397D;
    --s-brand-rgb: 0 57 125;
    --s-accent: #2f6fd0;

    min-height: 100vh;
    background:
        radial-gradient(42rem 30rem at 12% -8%, rgb(47 111 208 / .12), transparent 62%),
        radial-gradient(38rem 26rem at 92% 4%, rgb(255 184 122 / .10), transparent 60%),
        radial-gradient(44rem 34rem at 70% 108%, rgb(47 111 208 / .09), transparent 62%),
        var(--s-canvas);
    background-attachment: fixed;
    color: var(--s-ink);
    font-feature-settings: 'cv11', 'ss01';
    -webkit-font-smoothing: antialiased;
}

/* ======================= type ============================================ */
.wgg-shell h1,
.wgg-shell h2 {
    font-family: 'Instrument Sans', 'Inter', system-ui, sans-serif;
    letter-spacing: -.028em;
    color: var(--s-ink);
}

.wgg-shell h1 { font-size: 1.5rem; font-weight: 600; }

.wgg-shell .shell-eyebrow {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .6875rem;
    font-weight: 500;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--s-faint);
}

/* ======================= the bar: glass over the page ==================== */
.wgg-shell .shell-bar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: linear-gradient(180deg, rgb(0 26 58 / .82), rgb(0 20 46 / .72));
    -webkit-backdrop-filter: blur(20px) saturate(170%);
    backdrop-filter: blur(20px) saturate(170%);
    border-bottom: 1px solid rgb(255 255 255 / .10);
    box-shadow: 0 1px 0 0 rgb(255 255 255 / .06) inset, 0 10px 30px -18px rgb(0 20 46 / .80);
    color: #fff;
}

/* nav pills: extruded in the bar's own material rather than flat tints */
.wgg-shell .shell-nav {
    border-radius: 10px;
    padding: .375rem .75rem;
    font-size: .875rem;
    color: rgb(255 255 255 / .72);
    background: transparent;
    transition: background-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.wgg-shell .shell-nav:hover { background: rgb(255 255 255 / .08); color: #fff; }

.wgg-shell .shell-nav.is-on {
    color: #fff;
    font-weight: 600;
    background: rgb(255 255 255 / .14);
    box-shadow:
        0 1px 0 0 rgb(255 255 255 / .18) inset,
        0 -1px 0 0 rgb(0 0 0 / .18) inset,
        0 2px 8px -3px rgb(0 0 0 / .45);
}

.wgg-shell .shell-barbtn {
    border-radius: 10px;
    padding: .375rem .75rem;
    font-size: .875rem;
    color: #fff;
    background: rgb(255 255 255 / .10);
    border: 1px solid rgb(255 255 255 / .14);
    box-shadow: 0 1px 0 0 rgb(255 255 255 / .14) inset;
    transition: background-color .16s ease, transform .16s ease;
}

.wgg-shell .shell-barbtn:hover { background: rgb(255 255 255 / .20); }
.wgg-shell .shell-barbtn:active { transform: translateY(1px); }

/* ======================= tiles: soft-UI, extrusion as state ============== */
.wgg-shell .shell-tile {
    position: relative;
    display: block;
    padding: 1.35rem;
    border-radius: 20px;
    background: linear-gradient(145deg, var(--s-raise-a), var(--s-raise-b));
    border: 1px solid rgb(255 255 255 / .75);
    box-shadow:
        9px 9px 22px var(--s-dark),
        -9px -9px 22px var(--s-light),
        0 1px 0 0 rgb(255 255 255 / .85) inset;
    transition:
        box-shadow .26s cubic-bezier(.16, 1, .3, 1),
        transform .26s cubic-bezier(.16, 1, .3, 1);
}

.wgg-shell a.shell-tile:hover {
    transform: translateY(-3px);
    box-shadow:
        14px 14px 32px var(--s-dark),
        -12px -12px 28px var(--s-light),
        0 1px 0 0 rgb(255 255 255 / .95) inset;
}

/* pressed: the shadows invert, so the tile goes into the page under the
   finger. This is the whole point of soft-UI and it costs one rule. */
.wgg-shell a.shell-tile:active {
    transform: translateY(0);
    box-shadow:
        inset 6px 6px 14px var(--s-dark),
        inset -6px -6px 14px var(--s-light);
}

/* no access: sunk, not greyed. The state is legible before the label is. */
.wgg-shell .shell-tile.is-locked {
    background: linear-gradient(145deg, #e2e8f2, #edf1f8);
    border-color: rgb(255 255 255 / .45);
    box-shadow:
        inset 5px 5px 13px var(--s-dark-soft),
        inset -5px -5px 13px rgb(255 255 255 / .85);
}

.wgg-shell .shell-tile.is-locked .shell-tile-t { color: var(--s-dim); }

/* the icon plate */
.wgg-shell .shell-chip {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    flex: none;
    border-radius: 14px;
    font-size: 1.0625rem;
    color: var(--s-brand);
    background: linear-gradient(145deg, #ffffff, #dce5f3);
    box-shadow:
        4px 4px 10px var(--s-dark-soft),
        -4px -4px 10px rgb(255 255 255 / .95),
        0 1px 0 0 rgb(255 255 255 / .9) inset;
}

.wgg-shell .shell-tile.is-locked .shell-chip {
    color: var(--s-faint);
    background: #e5eaf3;
    box-shadow: inset 3px 3px 7px var(--s-dark-soft), inset -3px -3px 7px rgb(255 255 255 / .85);
}

.wgg-shell .shell-tile-t {
    font-family: 'Instrument Sans', system-ui, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -.018em;
    color: var(--s-ink);
}

.wgg-shell .shell-tile-d {
    margin-top: .3rem;
    font-size: .875rem;
    line-height: 1.55;
    color: var(--s-dim);
}

/* ======================= badges ========================================== */
.wgg-shell .shell-badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    border-radius: 999px;
    padding: .175rem .55rem;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .625rem;
    font-weight: 500;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--s-brand);
    background: linear-gradient(145deg, #e8effb, #d6e2f4);
    box-shadow:
        1px 1px 3px var(--s-dark-soft),
        -1px -1px 3px rgb(255 255 255 / .9),
        0 0 0 1px rgb(var(--s-brand-rgb) / .08) inset;
}

.wgg-shell .shell-badge.is-muted {
    color: var(--s-faint);
    background: #e4e9f2;
    box-shadow: inset 1px 1px 3px var(--s-dark-soft), inset -1px -1px 3px rgb(255 255 255 / .85);
}

.wgg-shell .shell-note {
    margin-top: .6rem;
    font-size: .75rem;
    color: #2f8f63;
}

.wgg-shell .shell-tile.is-locked .shell-note { color: var(--s-faint); }

/* ======================= panels, fields, buttons ========================= */
.wgg-shell .shell-panel {
    border-radius: 18px;
    background: linear-gradient(145deg, #fbfcfe, #eaeff8);
    border: 1px solid rgb(255 255 255 / .7);
    box-shadow:
        7px 7px 18px var(--s-dark-soft),
        -7px -7px 18px var(--s-light),
        0 1px 0 0 rgb(255 255 255 / .85) inset;
    overflow: hidden;
}

/* fields are pressed into the surface - that is what says "type here" */
.wgg-shell .input,
.wgg-shell select,
.wgg-shell input[type="text"],
.wgg-shell input[type="email"],
.wgg-shell input[type="search"] {
    border: 1px solid rgb(255 255 255 / .6);
    border-radius: 11px;
    background: #e6ebf4;
    color: var(--s-ink);
    box-shadow: inset 3px 3px 8px var(--s-dark-soft), inset -3px -3px 8px rgb(255 255 255 / .9);
    transition: box-shadow .18s ease;
}

.wgg-shell .input:focus,
.wgg-shell select:focus,
.wgg-shell input:focus {
    outline: none;
    box-shadow:
        inset 3px 3px 8px var(--s-dark-soft),
        inset -3px -3px 8px rgb(255 255 255 / .9),
        0 0 0 3px rgb(var(--s-brand-rgb) / .22);
}

/* Autofill, same trap as the gate: Chrome's fill cannot be overridden by
   background-color, and a rule that loses the shadow while winning the text
   colour is worse than no rule at all. Both or neither. */
.wgg-shell input:-webkit-autofill,
.wgg-shell input:-webkit-autofill:hover,
.wgg-shell input:-webkit-autofill:focus,
.wgg-shell select:-webkit-autofill,
.wgg-shell input:autofill,
.wgg-shell input:autofill:focus {
    -webkit-text-fill-color: var(--s-ink) !important;
    caret-color: var(--s-ink) !important;
    -webkit-box-shadow:
        0 0 0 1000px #e6ebf4 inset,
        inset 3px 3px 8px var(--s-dark-soft) !important;
    box-shadow:
        0 0 0 1000px #e6ebf4 inset,
        inset 3px 3px 8px var(--s-dark-soft) !important;
    transition: background-color 9999s ease-out 0s !important;
}

.wgg-shell .shell-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    border-radius: 12px;
    padding: .55rem 1rem;
    font-size: .875rem;
    font-weight: 600;
    border: 1px solid rgb(255 255 255 / .7);
    background: linear-gradient(145deg, #fbfcfe, #e4eaf5);
    color: var(--s-ink);
    box-shadow: 4px 4px 11px var(--s-dark-soft), -4px -4px 11px var(--s-light);
    transition: box-shadow .18s ease, transform .18s ease;
}

.wgg-shell .shell-btn:hover:not(:disabled) {
    box-shadow: 6px 6px 15px var(--s-dark), -6px -6px 15px var(--s-light);
}

.wgg-shell .shell-btn:active:not(:disabled) {
    box-shadow: inset 4px 4px 10px var(--s-dark-soft), inset -4px -4px 10px rgb(255 255 255 / .9);
}

.wgg-shell .shell-btn-primary {
    color: #fff;
    border-color: rgb(var(--s-brand-rgb) / .55);
    background: linear-gradient(145deg, #1f6ad1, var(--s-brand));
    box-shadow:
        0 1px 0 0 rgb(255 255 255 / .26) inset,
        5px 5px 14px rgb(var(--s-brand-rgb) / .30),
        -4px -4px 12px var(--s-light);
}

.wgg-shell .shell-btn-primary:hover:not(:disabled) {
    filter: brightness(1.07);
    box-shadow:
        0 1px 0 0 rgb(255 255 255 / .32) inset,
        7px 7px 18px rgb(var(--s-brand-rgb) / .36),
        -4px -4px 12px var(--s-light);
}

.wgg-shell .shell-btn:disabled { opacity: .5; box-shadow: none; }

/* ======================= tables ========================================== */
.wgg-shell table thead {
    background: rgb(13 38 76 / .04);
    color: var(--s-dim);
}

.wgg-shell table tbody tr { transition: background-color .14s ease; }
.wgg-shell table tbody tr:hover { background: rgb(255 255 255 / .6); }

/* ======================= dialog: glass, because it floats ================ */
.wgg-shell .shell-scrim {
    background: rgb(10 22 44 / .55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.wgg-shell .shell-dialog {
    border-radius: 20px;
    background: rgb(249 251 254 / .86);
    border: 1px solid rgb(255 255 255 / .85);
    -webkit-backdrop-filter: blur(26px) saturate(170%);
    backdrop-filter: blur(26px) saturate(170%);
    box-shadow: 0 32px 70px -26px rgb(10 22 44 / .55), 0 1px 0 0 rgb(255 255 255 / .9) inset;
    overflow: hidden;
}

/* ======================= focus: a ring, never a shadow =================== */
/* Soft-UI's usual accessibility failure is a focus state made of shadow,
   which is invisible against shadowed surfaces. This is a ring. */
.wgg-shell :focus-visible {
    outline: 2px solid var(--s-brand);
    outline-offset: 2px;
    border-radius: 8px;
}

/* ======================= entrance ======================================== */
.wgg-shell .shell-tile { animation: s-rise .5s cubic-bezier(.16, 1, .3, 1) backwards; }
.wgg-shell .shell-tile:nth-child(1) { animation-delay: .04s; }
.wgg-shell .shell-tile:nth-child(2) { animation-delay: .10s; }
.wgg-shell .shell-tile:nth-child(3) { animation-delay: .16s; }
.wgg-shell .shell-tile:nth-child(4) { animation-delay: .22s; }
.wgg-shell .shell-tile:nth-child(5) { animation-delay: .28s; }
.wgg-shell .shell-tile:nth-child(n+6) { animation-delay: .34s; }

@keyframes s-rise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .wgg-shell .shell-tile,
    .wgg-shell .shell-btn,
    .wgg-shell .shell-nav { animation: none; transition: none; }

    .wgg-shell a.shell-tile:hover { transform: none; }
}

/* ======================= degradation and contrast ======================== */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .wgg-shell .shell-bar { background: #001a3a; }
    .wgg-shell .shell-dialog { background: #f9fbfe; }
}

/* Soft shadows are the first thing to go when someone has asked for more
   contrast, because they are exactly what makes edges ambiguous. */
@media (prefers-contrast: more) {
    .wgg-shell {
        --s-dim: #33405a;
        --s-faint: #44536e;
    }

    .wgg-shell .shell-tile,
    .wgg-shell .shell-panel,
    .wgg-shell .shell-btn {
        background: #fff;
        border-color: #4a5a76;
        box-shadow: none;
    }

    .wgg-shell .shell-tile.is-locked { background: #e8ecf3; border-style: dashed; }
    .wgg-shell .input, .wgg-shell select { background: #fff; border-color: #4a5a76; box-shadow: none; }
}
