/*   = = =   Glass Panels : every panel a slab of crystal over the stage   = = =   */

/* - - - Every `.nk-glass` (the cards, the framed panels, the header, the island) is drawn here as crystal : in every
   browser a FROSTED backdrop (blurred, saturated and dimmed : Nk-Config.php's `glass` figures, emitted on :root) and
   a faint veil ; the header and the island keep a hairline, the panels in the page have no outline at all. Nothing
   here is lit from a side : a slab's light is the tower's. In Chromium, GlassPanels-Script.js lays an SVG filter of the panel's own size over this sheet's
   backdrop-filter (inline), which REFRACTS the light behind it (enlarged across the slab, bent at the bevelled rim)
   and BACKLIGHTS every edge with it : an edge shines where the tower stands behind it and stays dark where nothing
   does, moving with the scroll and the ripple.

   One class and one element (`html .nk-glass`), so it outranks every panel's own single-class rule, the veils the
   panels wear without the glass, whatever the sheets' order. Positions stay the panels' own : the header is fixed,
   every other one relative. - - - */



/*   = = = = = =   The Slab   = = = = = =   */

html .nk-glass
{
    --nk-glass-veil: 0.16;   /* a fallback : every surface's veil is Nk-Config.php's `surfaces` */
    border-color: rgba(var(--accent-rgb), 0.22);
    background-color: transparent;
    background-image: linear-gradient(rgba(var(--panel-rgb), var(--nk-glass-veil)), rgba(var(--panel-rgb), var(--nk-glass-veil)));
    -webkit-backdrop-filter: blur(var(--nk-glass-blur, 0.9px)) saturate(var(--nk-glass-saturation, 1.4)) brightness(calc(var(--nk-glass-brightness, 0.85) * var(--nk-glass-light, 1)));
    backdrop-filter: blur(var(--nk-glass-blur, 0.9px)) saturate(var(--nk-glass-saturation, 1.4)) brightness(calc(var(--nk-glass-brightness, 0.85) * var(--nk-glass-light, 1)));
}

/* - - - THE EXPERIENCE ROLES are glass within glass : the light behind a role is its organisation's frame, already
   dimmed by the frame's brightness and veil, and the role dims it again (0.71 of the frame's light, measured ; a veil
   of 0 with a share of 1.3 matches the frame). So they have a veil and a share of the brightness of their own (Nk-Config.php `surfaces.roles`,
   `--nk-glass-veil` and `--nk-glass-light`, printed on `html .nk-org .file-card.nk-glass.nk-card`, a class more than
   the panels' selector so theirs stand), and take every other figure from the panels. - - - */



/*   = = = = = =   A Panel Holding Panels   = = = = = =   */

/* - - - A PANEL THAT HOLDS GLASS PANELS (`nk-glass-host` : an organisation's frame, its roles inside) DRAWS ITS GLASS
   AND ITS VEIL ON A LAYER BENEATH ITS CONTENT (`nk-glass-layer`, its first child), never on itself. An element with a
   backdrop-filter is a BACKDROP ROOT : the glass inside it sees only what that element paints, never the tower behind
   it, and the roles drew pure black (0 of 255 measured at their middle, where the frame's glass between them showed
   the tower at 7 ; with the frame's glass off they showed it at 6). The layer is the frame's sibling to the roles,
   not their ancestor, so their glass sees the tower through the frame's glass : glass on glass. GlassPanels-Script.js
   gives the layer the frame's filter, made for the frame's size ; the layer covers the frame's border box (its 1px
   border, `inset: -1px`), as the frame's own glass did. Nothing above the roles may take an opacity under 1, a filter,
   a mask or a backdrop-filter, or they turn black again : the frame's arrival fades its parts, not itself (below). - - - */
html .nk-glass.nk-glass-host
{
    background-image: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}
html .nk-glass-host > .nk-glass-layer
{
    position: absolute;
    inset: -1px;
    z-index: -1;
    pointer-events: none;
    border-radius: inherit;
    background-image: linear-gradient(rgba(var(--panel-rgb), var(--nk-glass-veil)), rgba(var(--panel-rgb), var(--nk-glass-veil)));
    -webkit-backdrop-filter: blur(var(--nk-glass-blur, 0.9px)) saturate(var(--nk-glass-saturation, 1.4)) brightness(calc(var(--nk-glass-brightness, 0.85) * var(--nk-glass-light, 1)));
    backdrop-filter: blur(var(--nk-glass-blur, 0.9px)) saturate(var(--nk-glass-saturation, 1.4)) brightness(calc(var(--nk-glass-brightness, 0.85) * var(--nk-glass-light, 1)));
}

/* - - - A FRAME HOLDING GLASS PANELS DRAWS NO SHEEN ; its roles keep their own. Behind the roles its sheen was bent
   by their rims and lit by their edge light, up to ten times its light : white frames round the roles, which the
   owner saw on a phone showing the desktop site ("the reflections are way too bright"). Measured there on the first
   role's top edge : 121 of 255, a third of it near white, against 23 without the frame's sheen (and 120 without the
   role's own, which was not the cause). It showed only in the strips round the roles anyway. - - - */
html .nk-glass.nk-glass-host:not(.nk-header):not(.island-shell)::after
{
    content: none;
}

/* - - - The frame's arrival (Theme-Styling.css's `nk-reveal`) : the frame keeps its slide, but its OPACITY goes to its
   parts (the layer, its title and line, each role), since an opacity under 1 on the frame would black out every role
   for as long as it fades. - - - */
html.nk-js .nk-reveal.nk-glass-host,
html.nk-js .nk-reveal.nk-glass-host.is-revealed
{
    opacity: 1;
}
html.nk-js .nk-reveal.nk-glass-host > :not(.nk-card-grid),
html.nk-js .nk-reveal.nk-glass-host > .nk-card-grid > *
{
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}
html.nk-js .nk-reveal.nk-glass-host.is-revealed > :not(.nk-card-grid),
html.nk-js .nk-reveal.nk-glass-host.is-revealed > .nk-card-grid > *
{
    opacity: 1;
}
html.nk-js .nk-reveal.nk-glass-host.is-away > :not(.nk-card-grid),
html.nk-js .nk-reveal.nk-glass-host.is-away > .nk-card-grid > *
{
    transition: none;
}
@media (prefers-reduced-motion: reduce)
{
    html.nk-js .nk-reveal.nk-glass-host > :not(.nk-card-grid),
    html.nk-js .nk-reveal.nk-glass-host > .nk-card-grid > *
    {
        opacity: 1;
        transition: none;
    }
}

/* - - - EACH SURFACE'S OWN FIGURES ARE NK-CONFIG.PHP'S `surfaces` : the panels', the header's and the island's rim,
   rim cap, veil, frost, sheen and the rest, printed by index.php after every sheet as custom properties on the same
   three selectors this sheet uses, and adjusted in the effects editor. Why each is what it is, below.

   Every panel's refraction reaches a tenth deeper in than the configured rim, its edge light with it, and its rim
   may take 0.385 of its shorter side (the script's own cap is 0.35), the owner's word : the panels alone, not the
   header or the island, which keep theirs. - - - */

/* - - - A PANEL IN THE PAGE HAS NO OUTLINE, the owner's word : "a glass shouldn't have visible outlines". Its hairline
   border, and the polished edge once drawn inside it, broke the refraction and made the glass look fake. The border
   keeps its pixel, so nothing moves, and loses its colour, the cards' hover outline with it : a panel's edge is where
   its refraction begins. Reduced transparency (below) gives the border back, since its solid panels have nothing
   else to part them from the ground. - - - */
html .nk-glass:not(.nk-header):not(.island-shell)
{
    border-color: transparent;
}

/* - - - The chrome has the page's own words passing under it, and refracted sharp they fight its marks : each has a
   frost and a veil of its own. GlassPanels-Script.js reads each panel's own `--nk-glass-blur`, and its shares of the
   configured backlight, rim depth, rim bend and enlargement (`--nk-glass-backlight`, `--nk-glass-rim`,
   `--nk-glass-bend`, `--nk-glass-lens`, 1 where unset), and of its left and right (`--nk-glass-sides`), so these
   are the refraction's figures too.

   The island's refraction reaches further in than a panel's but is gentle, the owner's word, twice over : its rim
   may take 0.42 of its height (`--nk-glass-rim-cap`; the script's own cap of 0.35 the island already met), and it
   bends and enlarges less than a panel and shines with six tenths of a panel's backlight, under a lighter frost
   than it had (6px under a 0.45 veil, from 8px under 0.55). Twice a panel's bend and enlargement and half again its
   backlight was too intense, and so, still, was a quarter more bend and enlargement with nine tenths of its light.
   Under a frost of 3.5px, the page's white words passing beneath were drawn into the rim as white smears.
   (Nk-Config.php `surfaces.island`.) - - - */

/* - - - The header is frosted, more lightly than it once was (8px under a 0.55 veil), and its rim is deeper than a
   panel's, the owner's word : the frost is what keeps the page passing under it from folding into stripes across the
   name, so the rim may take most of the header. Then a tenth more frost and a tenth less rim, the owner's word : the
   frost 3px to 3.3px, the rim's share and its cap alike (1.3 and 0.35 to 1.17 and 0.315), so the rim is a tenth
   shallower on every screen, whichever of the two bounds it.

   The header has NO LEFT OR RIGHT REFRACTION, the owner's word (`--nk-glass-sides: 0`) : as wide as the screen, it
   has no side edges to bend at, so it has no rims there and no edge light there, and enlarges nothing across ; its
   top and bottom rims run its whole width. ITS TWO GLOWS, the edge light along its top and its foot, show at 0.85
   (`--nk-glass-glow`, 1 where unset), the owner's word : fifteen per cent fainter, and the effects editor's "Top and
   bottom glow" for the owner to adjust (GlassPanels-Script.js, "How much of the edge light shows"). (Nk-Config.php
   `surfaces.header`.) - - - */



/*   = = = = = =   A Fast Scroll : the Panels Plain   = = = = = =   */

/* - - - While the page scrolls fast (GlassPanels-Script.js), a panel drops its refraction and stands plain over the
   live tower, its veil deepened (inline) to keep the light as bright. The panel stays its own stacking context
   (`z-index: 0`), as its refraction makes it, so nothing inside it is stacked anew when the refraction goes off and
   comes back. - - - */
html.nk-refract .nk-glass:not(.nk-header):not(.island-shell)
{
    z-index: 0;
}



/*   = = = = = =   The Surface : What the Glass Reflects   = = = = = =   */

/* - - - A slab of glass shows what is behind it (the refraction) and what is in front of it : its surface REFLECTS.
   On the panels (not on the header or the island, which never move under the light), a SHEEN : a soft band of light
   lying across the glass, which glides over each panel as the page carries it past : a scroll-driven animation the
   browser's compositor runs, so it costs no script and no frame, and moves more slowly than the page, so it lingers
   on the screen as a reflection does. A browser without scroll timelines draws no sheen. (A polished edge, a
   hairline of light just inside the border, was drawn too, until the owner asked for no outlines.)

   THE SHEEN'S RANGE IS MEASURED FROM THE TOP OF THE SCREEN OVER `100lvh`, NEVER AGAINST THE SCREEN'S HEIGHT. A
   `view()` range such as `cover` is measured against the screen's height, which a phone's browser changes when its
   toolbar slides away or back, once a scroll comes to rest (Theme-Styling.css's `svh` rule, for the same cause) :
   every sheen jumped then, the owner saw it. `exit-crossing` from `--nk-scroll-pad - 100lvh` (the timeline's top
   inset is the root's scroll padding) to its end is `cover` exactly on a desktop or with the toolbar away, and
   nothing in it follows the toolbar.

   It lies between the panel's veil and its words (`z-index: -1` in the panel's own stacking context), the panel
   clipping it to its rounded edge (`overflow: clip`). - - - */
html .nk-glass:not(.nk-header):not(.island-shell)
{
    z-index: 0;
    overflow: clip;
}
@supports (animation-timeline: view())
{
    html .nk-glass:not(.nk-header):not(.island-shell)::after
    {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 300%;
        z-index: -1;
        pointer-events: none;
        background: linear-gradient(168deg,
            transparent 40%,
            rgba(var(--glass-rgb), var(--nk-glass-sheen, 0.06)) 46%,
            rgba(var(--glass-rgb), calc(var(--nk-glass-sheen, 0.06) * 1.6)) 49%,
            rgba(var(--glass-rgb), var(--nk-glass-sheen, 0.06)) 52%,
            transparent 57%,
            transparent 60%,
            rgba(var(--glass-rgb), calc(var(--nk-glass-sheen, 0.06) * 0.6)) 62.5%,
            transparent 65%);
        animation: nk-glass-sheen linear both;
        animation-timeline: view();
        animation-range: exit-crossing calc(var(--nk-scroll-pad, 0px) - 100lvh) exit-crossing 100%;
    }
}
@keyframes nk-glass-sheen
{
    from { transform: translateY(-66.667%); }
    to   { transform: translateY(0); }
}



/*   = = = = = =   The Filters' Home   = = = = = =   */

/* - - - The SVG GlassPanels-Script.js keeps every panel's filter in : no size, out of the flow. Never `display:
   none`, under which a browser may stop resolving the filters inside it. - - - */
.nk-glass-filters
{
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}



/*   = = = = = =   Reduced Transparency   = = = = = =   */

/* - - - A visitor who asks for it gets solid panels : no frost, no refraction (the script draws none either). - - - */
@media (prefers-reduced-transparency: reduce)
{
    html .nk-glass
    {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        background-image: linear-gradient(rgba(var(--panel-rgb), 0.92), rgba(var(--panel-rgb), 0.92));
    }
    html .nk-glass:not(.nk-header):not(.island-shell)
    {
        border-color: rgba(var(--accent-rgb), 0.22);
    }
    html .nk-glass-host > .nk-glass-layer
    {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        background-image: linear-gradient(rgba(var(--panel-rgb), 0.92), rgba(var(--panel-rgb), 0.92));
    }
}



/* - - - Author : Nikolaos S. Kaounas - - - */
