/* HANG easter egg: opens from the copyright line on home and case pages (js/hang-egg.js). Full-viewport wireframe letters (js/hang-wire.js), ink strokes on --page.
   Full-viewport layer in the page colour, z 50, so the light/dark toggle (z 60) stays on top and switches the egg live.
   H A N G sits on the bottom row, centred, level with the theme toggle. Bitcount label at 20px.
   Close = the Studio presentation's "× CLOSE" (projects/studio-present.js: .bar.deck-bar > nav.bar-right > a.ax with .arr.arr-back + .t),
   same markup and classes, top right of the viewport inside the safe area. Its icon comes from css/arrows.css (shared with the homepage);
   the case.css / studio.html header rules the homepage doesn't load are repeated below, scoped to .hegg, with the same values. */
/* copyright hover = the home nav / footer links: 1px line grows from the left */
footer.bot>span.hegg-trg{position:relative;width:fit-content;cursor:pointer}
footer.bot>span.hegg-trg .t{position:relative;display:inline-block}
footer.bot>span.hegg-trg .t::after{content:"";position:absolute;left:0;right:0;bottom:-3px;height:1px;background:currentColor;transform:scaleX(0);transform-origin:left;transition:transform .25s ease;pointer-events:none}
footer.bot>span.hegg-trg:hover .t::after,footer.bot>span.hegg-trg:focus-visible .t::after{transform:scaleX(1)}
/* copyright hover with a mouse, or on touch a loop while it is fully in view (js/hang-egg.js .is-smile: on 2384ms, off 2384ms = each transition + a 2000ms hold; none with reduced motion): the © smiles (Feather "smile" at the ©'s scale). The C's opening swings to the top as it trims into the smile arc on the same circle, so the mouth's low point stays where the C's bottom sits (113.6deg centred on the bottom, less the round ends: 320ms), then the eyes pop in, left then right (+160 / +224ms, 160ms each); hover-out is the same timeline backwards, eyes out first */
footer.bot>span.hegg-trg .c-arc{transition:transform .32s cubic-bezier(.2,.7,.2,1) .064s,stroke-dasharray .32s cubic-bezier(.2,.7,.2,1) .064s}
footer.bot>span.hegg-trg .c-eye{transition:transform .16s cubic-bezier(.2,.7,.2,1) .064s}
footer.bot>span.hegg-trg .c-eye-r{transition-delay:0s}
footer.bot>span.hegg-trg:is(:hover,.is-smile) .c-arc{transform:translateY(0) rotate(44.43deg) scale(1);stroke-dasharray:5.408 15.955;transition-delay:0s}
footer.bot>span.hegg-trg:is(:hover,.is-smile) .c-eye{transform:scale(1);transition-timing-function:cubic-bezier(.2,.7,.2,1.32);transition-delay:.16s}
footer.bot>span.hegg-trg:is(:hover,.is-smile) .c-eye-r{transition-delay:.224s}
@media (prefers-reduced-motion:reduce){footer.bot>span.hegg-trg .t::after,footer.bot>span.hegg-trg .c-arc,footer.bot>span.hegg-trg .c-eye{transition:none}}
.hegg{position:fixed;inset:0;z-index:50;display:grid;place-items:center;background:var(--page);opacity:0;transition:opacity .3s var(--ease);touch-action:none;overscroll-behavior:contain}
/* paper grain, HANG egg only (.hegg-egg, js/hang-egg.js EGG cfg; the phone full-screen prototype .hegg.proto-full has none), both themes: a 256px fractal tile shown at 128px, so a speck is one device pixel on a 2x screen. Overlay darkens the light page and lightens the dark page. Static image, not redrawn. */
.hegg.hegg-egg::before{content:"";position:absolute;inset:0;z-index:0;pointer-events:none;background-image:url("grain.png?v=336");background-size:128px 128px;opacity:.72;mix-blend-mode:overlay}
/* centre glow, HANG egg only (.hegg-egg; not .proto-full): a static radial gradient on the layer background, so it sits under the grain (::before). Fades to transparent before the .hegg-edge strips (60% x 43% of the layer). Per theme via --egg-glow: light 45% white, dark 4% white. .hegg-grow (later, same specificity) still clears it. */
.hegg.hegg-egg{--egg-glow:rgba(255,255,255,.45);--egg-glow-mid:rgba(255,255,255,.225);background:radial-gradient(ellipse 60% 43% at 50% 50%,var(--egg-glow) 0,var(--egg-glow-mid) 45%,rgba(255,255,255,0) 100%),var(--page)}
html[data-theme=dark] .hegg.hegg-egg{--egg-glow:rgba(255,255,255,.04);--egg-glow-mid:rgba(255,255,255,.02)}
/* v521: with js eggBg() the glow is the dithered canvas .hegg-bg (same gradient, no 8-bit rings); the CSS gradient above stays as the no-JS fallback. Under the grain (z -1 in the layer). Not while growing (the layer is transparent then). */
.hegg.hegg-egg.egg-dith:not(.hegg-grow){background:var(--page)}
.hegg-bg{position:absolute;inset:0;width:100%;height:100%;z-index:-1;pointer-events:none;image-rendering:pixelated}
.hegg.hegg-grow .hegg-bg{display:none}
/* iOS Safari bars, ported from the Studio presentation as it works on iPhone (projects/studio.html .deck-flow/.deck-edge, commits
   18ac7e0, a735500, f5acbcf): iOS 26 Safari does not take its bar tint from a full-screen fixed layer. Once the layer has faded in,
   html.hegg-flow makes it the document itself (in normal flow, one viewport tall, 2px of scroll range for js/theme.js's re-sample
   nudge); the page is collapsed out of flow and hidden (not display:none, so the homepage intro animations are not restarted);
   two solid full-width fixed edge strips in the layer colour sit at the top and bottom edges; html/body/theme-color = --page (theme.js).
   While open nothing cross-fades on a theme toggle (html, body, layer, strips switch instantly), so Safari never samples a half-way colour.
   hang-egg.js adds viewport-fit=cover while open, so the layer and the strips run under the status bar and toolbar. */
.hegg,.hegg:focus,.hegg:focus-visible{border-radius:0;outline:none;box-shadow:0 0 0 100vmax var(--page)}
.hegg.on{opacity:1}
/* grow (js/hang-egg.js cfg.grow): while the view expands from / collapses into the page the layer paints nothing (the cfg draws its own
   expanding panel, js/fs-motion.js timeline), no fade */
.hegg.hegg-grow,.hegg.hegg-grow:focus,.hegg.hegg-grow:focus-visible{background:none;box-shadow:none;opacity:1;transition:none}
.hegg-wire{position:absolute;inset:0;z-index:1;touch-action:none}
.hegg-wire canvas{position:absolute;inset:0;width:100%;height:100%;display:block;cursor:default;touch-action:none;background:transparent;user-select:none}
/* a drag starts only on the letter itself (js/hang-wire.js hit()): grab shows over the letter, not the whole page */
.hegg-wire canvas.is-over{cursor:grab}
.hegg-wire canvas.is-dragging{cursor:grabbing}
/* centred, only as wide as H A N G (no left/right stretch): a full-width fixed row is what iOS 26 Safari's edge sampler (it ignores pointer-events) takes as the bottom bar, and with no background it keeps the colour sampled at open; the solid .hegg-edge-b strip under it must be the edge element so the toolbar follows the layer and the toggle, as .hegg-edge-t does at the top */
.hegg-letters{position:fixed;left:50%;right:auto;bottom:calc(var(--tb-x, clamp(16px, 3vw, 32px)) + env(safe-area-inset-bottom, 0px));z-index:3;height:32px;width:max-content;margin:0;padding:0;display:flex;justify-content:center;align-items:center;gap:8px;transform:translateX(-50%);pointer-events:none}
.hegg-letters button{appearance:none;position:relative;border:0;outline:none;background:transparent;color:var(--ink);font:var(--t-label);font-size:20px;letter-spacing:var(--t-label-ls);word-spacing:var(--t-label-ws);text-transform:uppercase;-webkit-font-smoothing:none;height:32px;padding:0 14px;cursor:pointer;pointer-events:auto}
/* underline sits on the glyph: 1.5px left of the padding box, and the same gap under the dots the 16px size had */
.hegg-letters button::after{content:"";position:absolute;left:12.5px;right:15.5px;bottom:3px;height:1px;background:currentColor;transform:scaleX(0);transform-origin:left;transition:transform .25s ease}
.hegg-letters button:hover::after,.hegg-letters button[aria-pressed="true"]::after{transform:scaleX(1)}
@media (prefers-reduced-motion:reduce){.hegg-letters button::after{transition:none}}
html.hegg-open.theme-anim,html.hegg-open.theme-anim body,html.theme-anim .hegg,html.theme-anim .hegg *{transition:none!important}
html.hegg-flow{overflow:hidden}
@media (hover:none) and (pointer:coarse){html.hegg-flow{overflow:auto}}
html.hegg-flow,html.hegg-flow body{height:100%}
html.hegg-flow body{display:block;min-height:0;overflow:visible;margin:0;padding:0 0 2px;box-sizing:content-box}
html.hegg-flow body>:not(.hegg){position:absolute!important;top:0!important;left:0!important;right:0!important;width:auto!important;height:0!important;min-height:0!important;overflow:hidden!important;visibility:hidden!important;pointer-events:none!important}
html.hegg-flow .hegg{position:relative;inset:auto;width:100%;height:100%}
/* edge strips = Studio .deck-edge: top = the header row (58px, 50px <=640px) + safe area, bottom = clamp(16px,3vw,32px) + safe area.
   z-index 2: above the wire canvas (.hegg-wire, z 1) and below CLOSE / H A N G / the toggle (later in the DOM or z 3), as the Studio strips sit
   over its stage. iOS 26 Safari tints its bars from the topmost hit at the middle of each viewport edge (WebKit LocalFrameView::fixedContainerEdges):
   with the full-viewport canvas on top it found no fixed container, so Safari kept the colour of the last one it had seen, the open-time
   colour, and never followed the toggle. pointer-events:none is safe: that hit test ignores it (IgnoreCSSPointerEventsProperty) */
.hegg-edge{display:none;position:fixed;left:0;right:0;z-index:2;background:var(--page);pointer-events:none}
html.hegg-flow .hegg-edge{display:block}
.hegg-edge-t{top:0;height:calc(58px + env(safe-area-inset-top,0px))}
@media (max-width:640px){.hegg-edge-t{height:calc(50px + env(safe-area-inset-top,0px))}}
.hegg-edge-b{bottom:0;height:calc(clamp(16px,3vw,32px) + env(safe-area-inset-bottom,0px))}
/* the theme toggle joins the layer while it is open (as in the Studio presentation): position from the shared .theme-btn rule */
.hegg .theme-btn{z-index:3}
/* closing (Studio .deck-fs.is-closing): no clicks while CLOSE and the layer go out */
.hegg.is-closing{pointer-events:none}
/* CLOSE colours = the Studio presentation's bar (projects/studio.html .deck-bar per tone), so it renders the same where case.css styles
   .bar-right a (!important, from --mono-color/--ink) and on the homepage */
.hegg .hegg-bar{--mono-color:#333;--ink:#171717}
html[data-theme=dark] .hegg .hegg-bar{--mono-color:#cfcfcf;--ink:#f2f2f2}
/* the CLOSE row: hits pass through it to the strip, except on CLOSE itself */
.hegg .bar.hegg-bar{pointer-events:none}.hegg .hegg-bar .bar-right{pointer-events:auto}
/* Close (Studio CLOSE): bar = case.css .bar (58px, side inset 16-32px; <=900px 20-72px; <=640px 50px) + studio.html .deck-bar (safe area); fixed, not absolute: in html.hegg-flow the layer is in the document flow and iOS Safari scrolls it under its bars, the viewport-fixed row (as the theme toggle) stays in view. Right-anchored, only as wide as CLOSE (no left): a full-width fixed row is what iOS 26 Safari's top-edge sampler (it ignores pointer-events) takes as the top bar, and with no background it keeps the colour sampled at open; the solid .hegg-edge-t strip under it (the layer colour, as Studio's .deck-edge) must be the edge element so the status bar follows the layer and the toggle */
.hegg .bar.hegg-bar{position:fixed;top:env(safe-area-inset-top,0px);right:env(safe-area-inset-right,0px);z-index:2;display:flex;align-items:center;justify-content:flex-end;gap:16px;height:58px;margin:0;padding:0 clamp(16px,3vw,32px);background:none;-webkit-backdrop-filter:none;backdrop-filter:none}
@media (max-width:900px){.hegg .bar.hegg-bar{padding:0 clamp(20px,5vw,72px)}}
@media (max-width:640px){.hegg .bar.hegg-bar{height:50px}}
/* link = case.css .bar-right a (14px Bitcount mono, .04em, word-spacing -.32em, --mono-color as the Studio bar, --ink on hover) + hover/focus underline on .t */
.hegg .bar-right a.hegg-x{display:block;font-family:var(--mono);font-size:14px;font-weight:400;font-style:normal;line-height:1;letter-spacing:.04em;word-spacing:-.32em;text-transform:none;text-decoration:none;color:var(--mono-color);transition:color .2s}
.hegg .bar-right a.hegg-x:hover{color:var(--ink)}
.hegg .bar-right a.hegg-x .t{position:relative;display:inline-block}
.hegg .bar-right a.hegg-x .t::after{content:"";position:absolute;left:0;right:0;bottom:-3px;height:1px;background:currentColor;transform:scaleX(0);transform-origin:left;transition:transform .25s ease}
.hegg .bar-right a.hegg-x:hover .t::after{transform:scaleX(1)}
@media (prefers-reduced-motion:reduce){.hegg{transition:none}.hegg .bar-right a.hegg-x .t::after{transition:none}}
/* Studio presentation counter ("004/40"): the base rule moved here from projects/studio.html so the FMSS phone full-screen landscape
   message (js/case.js, .hegg.proto-full) uses it as is; studio.html keeps its breakpoint and layout rules after it */
.deck-n{position:absolute;z-index:2;right:calc(clamp(16px,3vw,32px) + env(safe-area-inset-right,0px));top:50%;transform:translateY(-50%);margin:0;font-family:var(--mono);font-size:var(--mono-size);letter-spacing:var(--mono-ls);word-spacing:-.32em;line-height:1;color:var(--mono-color);pointer-events:none;font-variant-numeric:tabular-nums}
/* FMSS phone full screen, turned to landscape (js/case.js): the device is hidden and the message sits mid-screen */
.hegg.proto-full .deck-n{position:fixed;right:auto;left:50%;top:50%;transform:translate(-50%,-50%);white-space:nowrap;text-align:center;line-height:1.6}
.hegg.proto-full .deck-n{--mono-color:#333;--ink:#171717}
html[data-theme=dark] .hegg.proto-full .deck-n{--mono-color:#cfcfcf;--ink:#f2f2f2}
/* the egg (js/hang-egg.js selOff, v502): nothing selectable while it is open; no long-press callout, no tap flash */
html.hegg-nosel,html.hegg-nosel *{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}
