/*
 * b8-ui — the one shared layer of byB8. Site, client panel, sign-in door and dashboard read
 * from here; nothing below is copied into their own stylesheets.
 * Color tokens (--b8-page, --b8-ink, --b8-accent …) come from ui/b8-ui.php as the inline
 * block of this handle, for the active mode. This file holds what does not change with
 * the hue: type, motion, space, corners, control sizes, title scale and the two materials.
 *
 * Page titles and the mobile switch stay with each surface (site 860px, panel, sign-in and
 * request form 900px), exactly as in 1.10.92.
 *
 * Author: B8hnam — https://by.b8hnam.com
 */

:root{
/* type */
--b8-font:"Yekan Bakh B8",system-ui,-apple-system,"Segoe UI",Tahoma,sans-serif;
--b8-display:"Peyda B8","Yekan Bakh B8",system-ui,sans-serif;
--b8-font-hero:var(--b8-display);
--b8-mono:"JetBrains Mono B8","JetBrains Mono",ui-monospace,Menlo,Consolas,monospace;

/* motion: color and ink changes ease; anything that moves uses a spring (linear()) */
--b8-ease-ink:cubic-bezier(.32,.72,0,1);
--b8-ease-effect:cubic-bezier(.2,0,0,1);
--b8-spring-fast:linear(0, 0.022, 0.076, 0.15, 0.236, 0.325, 0.413, 0.496, 0.574, 0.643, 0.705, 0.76, 0.806, 0.846, 0.879, 0.906, 0.929, 0.947, 0.962, 0.973, 0.982, 0.989, 0.994, 0.997, 1, 1.002, 1.003, 1.004, 1.004, 1.004, 1.004, 1.004, 1.003, 1.003, 1.003, 1.002, 1.002, 1.002, 1.001, 1.001, 1);
--b8-spring-normal:linear(0, 0.03, 0.107, 0.214, 0.336, 0.463, 0.585, 0.698, 0.798, 0.881, 0.949, 1.001, 1.039, 1.064, 1.079, 1.085, 1.085, 1.08, 1.072, 1.062, 1.051, 1.04, 1.03, 1.021, 1.013, 1.007, 1.002, 0.998, 0.995, 0.994, 0.993, 0.993, 0.993, 0.993, 0.994, 0.995, 0.996, 0.997, 0.998, 0.999, 1);
--b8-spring-soft:linear(0, 0.019, 0.068, 0.138, 0.219, 0.307, 0.396, 0.483, 0.565, 0.641, 0.709, 0.769, 0.821, 0.866, 0.903, 0.934, 0.959, 0.978, 0.993, 1.005, 1.013, 1.018, 1.021, 1.023, 1.023, 1.023, 1.022, 1.02, 1.018, 1.016, 1.014, 1.012, 1.01, 1.008, 1.007, 1.005, 1.004, 1.003, 1.002, 1.001, 1);
--b8-spring-playful:linear(0, 0.087, 0.3, 0.565, 0.824, 1.036, 1.18, 1.252, 1.261, 1.224, 1.161, 1.09, 1.025, 0.975, 0.944, 0.931, 0.933, 0.946, 0.964, 0.982, 0.998, 1.01, 1.017, 1.018, 1.017, 1.013, 1.008, 1.003, 0.999, 0.997, 0.995, 0.995, 0.996, 0.997, 0.998, 1, 1, 1.001, 1.001, 1.001, 1);

/* space: one scale, 4px base */
--b8-s-1:4px;--b8-s-2:8px;--b8-s-3:12px;--b8-s-4:16px;--b8-s-5:24px;--b8-s-6:32px;--b8-s-7:48px;--b8-s-8:64px;--b8-s-9:96px;

/* corners */
--b8-r-xs:8px;--b8-r-sm:12px;--b8-r-md:16px;--b8-r-lg:22px;--b8-r-xl:28px;--b8-r-pill:999px;

/* controls: the default heights and corner of 1.10.92; surfaces keep their own sizes where they differ */
--b8-ctl-sm:44px;--b8-ctl:52px;--b8-ctl-lg:58px;
--b8-btn-r:var(--b8-r-md);--b8-btn-px:24px;

/* glass: one material. --b8-glass is the tint; Apple WebKit (Safari and every browser on
   iOS) gets the denser --b8-lg-safe, so the glass is never clearer than iOS's own. */
--b8-lg-filter:blur(18px) saturate(1.6);
}

@supports not (transition-timing-function:linear(0,1)){:root{
--b8-spring-fast:cubic-bezier(.2,1.2,.3,1);
--b8-spring-normal:cubic-bezier(.3,1.25,.4,1);
--b8-spring-soft:cubic-bezier(.25,1.1,.4,1);
--b8-spring-playful:cubic-bezier(.3,1.5,.4,1);
}}

/* ---------- materials ---------- */
.b8-glass{background:var(--b8-glass);border:1px solid var(--b8-hair);-webkit-backdrop-filter:var(--b8-lg-filter);backdrop-filter:var(--b8-lg-filter);box-shadow:var(--b8-lift);transition:background-color 700ms var(--b8-ease-ink),border-color 700ms var(--b8-ease-ink),box-shadow 700ms var(--b8-ease-ink)}
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){.b8-glass{background:var(--b8-matte)}}
@media (prefers-reduced-transparency: reduce){.b8-glass{-webkit-backdrop-filter:none;backdrop-filter:none;background:var(--b8-matte)}}
.b8-matte{background:var(--b8-matte);color:var(--b8-matte-ink);border:1px solid var(--b8-matte-line);transition:background-color 700ms var(--b8-ease-ink),color 700ms var(--b8-ease-ink),border-color 700ms var(--b8-ease-ink)}

/* lens glass: the capsule of the header and the footer, and the phone sheet. Level with iOS
   (blur 6px, tint .32 dark / .50 light), never clearer. Chromium bends the edge with the SVG
   lens (b8_ui_lens_svg); Apple WebKit has no lens there, so it gets more blur and the denser tint. */
/* the lens material lives in variables set on the part itself (so a light #wpbody gets light
   values). Dashboard parts WordPress prints without our class take the same variables in shell.css:
   the admin bar submenus and the side menu flyouts (lock 72: every glass from this one source). */
.b8-lens,#wpadminbar .menupop .ab-sub-wrapper,#adminmenu .wp-submenu{--b8-lens-bg:var(--b8-lg-tint);--b8-lens-f:blur(6px) saturate(1.7);--b8-lens-ring:inset 0 1px 0 var(--b8-lg-hi),inset 0 -1px 0 var(--b8-lg-lo),inset 0 0 0 1px var(--b8-lg-rim),0 16px 36px var(--b8-lg-drop),0 2px 6px var(--b8-lg-drop)}
@supports (font:-apple-system-body){.b8-lens,#wpadminbar .menupop .ab-sub-wrapper,#adminmenu .wp-submenu{--b8-lens-bg:var(--b8-lg-safe);--b8-lens-f:blur(18px) saturate(1.8)}}
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){.b8-lens,#wpadminbar .menupop .ab-sub-wrapper,#adminmenu .wp-submenu{--b8-lens-bg:var(--b8-matte)}}
.b8-lens{position:relative;isolation:isolate;border:0;background:var(--b8-lens-bg);-webkit-backdrop-filter:var(--b8-lens-f);backdrop-filter:var(--b8-lens-f);box-shadow:var(--b8-lens-ring);transition:background-color 700ms var(--b8-ease-ink),box-shadow 700ms var(--b8-ease-ink)}
.b8-lens[data-b8-lens="pill"]{backdrop-filter:url(#b8-lens-pill) var(--b8-lens-f)}
@supports (font:-apple-system-body){.b8-lens[data-b8-lens]{backdrop-filter:var(--b8-lens-f)}}
@media (prefers-reduced-transparency: reduce){.b8-lens,.b8-lens[data-b8-lens],#wpadminbar .menupop .ab-sub-wrapper,#adminmenu .wp-submenu{--b8-lens-bg:var(--b8-matte);--b8-lens-f:none}.b8-lens,.b8-lens[data-b8-lens]{-webkit-backdrop-filter:none;backdrop-filter:none}}

/* ---------- edge glint (B8UI.glint draws the svg; the kind is data-b8-glint on the capsule) ---------- */
.b8-glint{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:2;overflow:hidden;border-radius:inherit}
.b8-glint rect{fill:none;stroke:var(--b8-glint);stroke-width:1.4px;stroke-linecap:butt;opacity:0}
.b8-glint .b8-r1{stroke-linecap:round}
@keyframes b8-glint-run{from{stroke-dashoffset:100}to{stroke-dashoffset:0}}
@keyframes b8-glint-beat{0%,100%{opacity:.18}50%{opacity:.9}}
@keyframes b8-glint-once-a{0%{stroke-dashoffset:100;opacity:0}10%{opacity:.9}88%{opacity:.9}100%{stroke-dashoffset:0;opacity:0}}
@keyframes b8-glint-once-b{0%{stroke-dashoffset:100;opacity:0}10%{opacity:.9}88%{opacity:.9}100%{stroke-dashoffset:0;opacity:0}}
@keyframes b8-glint-spot{0%{stroke-dashoffset:100;opacity:0}2%{opacity:.95}20%{opacity:.95}23%{stroke-dashoffset:0;opacity:0}100%{stroke-dashoffset:0;opacity:0}}
/* no motion asked for: no glint at all (the rects stay at opacity 0) */
@media (prefers-reduced-motion: no-preference){
[data-b8-glint="beat"] > .b8-glint .b8-r1{stroke-dasharray:9 91;animation:b8-glint-run 14s linear infinite,b8-glint-beat 3.5s ease-in-out infinite}
[data-b8-glint="comet"] > .b8-glint rect{stroke-dasharray:2.5 97.5;animation:b8-glint-run 13s linear infinite}
[data-b8-glint="comet"] > .b8-glint .b8-r1{opacity:.95;animation-delay:-.975s}
[data-b8-glint="comet"] > .b8-glint .b8-r2{opacity:.55;animation-delay:-.65s}
[data-b8-glint="comet"] > .b8-glint .b8-r3{opacity:.28;animation-delay:-.325s}
[data-b8-glint="comet"] > .b8-glint .b8-r4{opacity:.1}
[data-b8-glint="calm"] > .b8-glint .b8-r1{opacity:.8;stroke-dasharray:6 94;animation:b8-glint-run 12s linear infinite}
[data-b8-glint="twin"] > .b8-glint .b8-r1{opacity:.6;stroke-dasharray:4 46;animation:b8-glint-run 18s linear infinite}
[data-b8-glint="long"] > .b8-glint .b8-r1{opacity:.28;stroke-linecap:butt;stroke-dasharray:24 76;animation:b8-glint-run 22s linear infinite}
[data-b8-glint="long"] > .b8-glint .b8-r2{opacity:.55;stroke-linecap:round;stroke-dasharray:8 92;animation:b8-glint-run 22s linear -1.76s infinite}
[data-b8-glint="quick"] > .b8-glint .b8-r1{opacity:.9;stroke-dasharray:3 97;animation:b8-glint-run 6s linear infinite}
[data-b8-glint="ink"] > .b8-glint rect{stroke:var(--b8-home-text);stroke-dasharray:2.5 97.5;animation:b8-glint-run 14s linear infinite}
[data-b8-glint="ink"] > .b8-glint .b8-r1{opacity:.95;animation-delay:-1.05s}
[data-b8-glint="ink"] > .b8-glint .b8-r2{opacity:.55;animation-delay:-.7s}
[data-b8-glint="ink"] > .b8-glint .b8-r3{opacity:.25;animation-delay:-.35s}
[data-b8-glint="duo"] > .b8-glint .b8-r1{opacity:.85;stroke-dasharray:5 95;animation:b8-glint-run 16s linear infinite}
[data-b8-glint="duo"] > .b8-glint .b8-r2{opacity:.85;stroke:var(--b8-home-text);stroke-linecap:round;stroke-dasharray:5 95;animation:b8-glint-run 16s linear -8s infinite}
/* point of light: one turn after the page loads, then a short turn about every 10 seconds */
[data-b8-glint="spot"] > .b8-glint .b8-r1{stroke-dasharray:1.8 98.2;animation:b8-glint-spot 10s linear .6s infinite}
.b8-glint[data-b8-go="a"] .b8-r1{stroke-dasharray:10 90;animation:b8-glint-once-a 1.8s var(--b8-ease-effect) both}
.b8-glint[data-b8-go="b"] .b8-r1{stroke-dasharray:10 90;animation:b8-glint-once-b 1.8s var(--b8-ease-effect) both}
}

/* ---------- timed greeting: one small line above a title (b8_ui_greet) ---------- */
.b8-greet{display:block;font-size:13px;font-weight:800;line-height:1.8;color:var(--b8-muted)}
.b8-greet[hidden]{display:none}

/* ---------- button geometry (colors stay with each surface) ---------- */
:where(.b8-btn){display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:var(--b8-ctl);padding:0 var(--b8-btn-px);border-radius:var(--b8-btn-r);font-weight:800;font-size:16px;border:0;white-space:nowrap}
:where(.b8-btn-sm){min-height:var(--b8-ctl-sm);padding:0 16px;font-size:14px}
:where(.b8-btn-lg){min-height:var(--b8-ctl-lg);font-size:17px}

/* ---------- avatars (backoffice/no-gravatar): the byB8 image follows the device; a chosen mode swaps it ---------- */
html[data-b8-theme="dark"] img.avatar[src*="no-gravatar/assets/avatar.svg"]{content:url(../modules/backoffice/features/no-gravatar/assets/avatar-dark.svg)}
html[data-b8-theme="light"] img.avatar[src*="no-gravatar/assets/avatar.svg"]{content:url(../modules/backoffice/features/no-gravatar/assets/avatar-light.svg)}

/* ---------- code cells (canvas Signature): digits roll while the code is checked, land on the real digit ---------- */
.b8-roll{display:block;height:1.4em;overflow:hidden;line-height:1.4em}
.b8-roll>span{display:flex;flex-direction:column;animation:b8-roll linear infinite}
.b8-roll>span>span{height:1.4em}
@keyframes b8-roll{0%{transform:translateY(0)}100%{transform:translateY(-14em)}}
.b8-land{display:inline-block;animation:b8-land 520ms var(--b8-spring-playful,cubic-bezier(.2,1.4,.4,1)) both}
@keyframes b8-land{0%{transform:translateY(-.5em);opacity:.3}100%{transform:none;opacity:1}}
@keyframes b8-shake{0%,100%{transform:none}20%{transform:translateX(-10px)}40%{transform:translateX(8px)}60%{transform:translateX(-6px)}80%{transform:translateX(3px)}}

/* ---------- the stamp and its ink (canvas SigFinal76, lock 76): one component everywhere ----------
   b8_ui_reg() in PHP and B8UI.stamp() in JS print it. Color: --b8-st-c (home blue; paid green by
   Behnam's choice in chat 83; off = neutral with a dotted ring, the 404). The ink is not a filter on a
   moving element: B8UI.ink() draws it once as an SVG image (its own turbulence inside) and only
   transform and opacity move (performance method of chat 82). Reduced motion: still stamp, no ink. */
.b8-reg{--b8-st-c:var(--b8-home);position:relative;width:var(--b8-sz,150px);height:var(--b8-sz,150px);border-radius:50%;border:3px solid var(--b8-st-c);color:var(--b8-st-c);display:flex;align-items:center;justify-content:center;rotate:-10deg;margin:0 auto;flex-shrink:0;transition:border-color 700ms var(--b8-ease-ink),color 700ms var(--b8-ease-ink)}
.b8-reg[data-k="paid"]{--b8-st-c:var(--b8-ok)}
.b8-reg[data-k="off"],.b8-reg[data-k="muted"]{--b8-st-c:var(--b8-muted)}
.b8-reg[data-k="ok"]{--b8-st-c:var(--b8-ok)}
.b8-reg[data-k="danger"]{--b8-st-c:var(--b8-danger)}
.b8-reg-in{width:84%;height:84%;border-radius:50%;border:1px dashed currentColor;display:flex;flex-direction:column;align-items:center;justify-content:center;line-height:1.5;text-align:center}
.b8-reg[data-k="off"] .b8-reg-in{border-style:dotted}
.b8-reg-in .b8-code,.b8-reg-in [lang="en"]{font-family:var(--b8-mono,"JetBrains Mono",monospace);direction:ltr;unicode-bidi:isolate}
.b8-reg-k{font-size:calc(var(--b8-sz,150px)*.0533);letter-spacing:.22em}
.b8-reg-t{font-size:calc(var(--b8-sz,150px)*.1467);font-weight:900}
.b8-reg-c{font-size:calc(var(--b8-sz,150px)*.0667);letter-spacing:.12em}
.b8-reg-d{font-size:calc(var(--b8-sz,150px)*.0533);letter-spacing:.2em}
.b8-inkbox{position:absolute;inset:0;z-index:0;overflow:hidden;contain:strict;border-radius:inherit;pointer-events:none}
.b8-inkbox>img{position:absolute;display:block;max-width:none;opacity:.14;scale:2;transform-origin:50% 50%;will-change:transform,opacity;pointer-events:none;user-select:none}
:where([data-b8-ink]){position:relative;isolation:isolate}
:where([data-b8-ink])>:where(:not(.b8-inkbox)){position:relative;z-index:1}
/* a host without a card: the ink runs past its edges and fades out (status page, panel hero) */
[data-b8-ink="fade"]>.b8-inkbox{inset:-72px -48px;border-radius:0;-webkit-mask-image:radial-gradient(closest-side at var(--b8-ink-x,50%) var(--b8-ink-y,50%),#000 30%,transparent);mask-image:radial-gradient(closest-side at var(--b8-ink-x,50%) var(--b8-ink-y,50%),#000 30%,transparent)}
@media (prefers-reduced-motion: no-preference){
.b8-reg[data-b8-run]{animation:b8-reg 900ms var(--b8-spring-playful,cubic-bezier(.2,1.4,.4,1)) 120ms both}
.b8-inkbox>img[data-b8-run]{animation:b8-blot 1500ms var(--b8-ease-ink,ease) 380ms both}
}
@keyframes b8-reg{0%{scale:1.7;rotate:-28deg;opacity:0;filter:blur(3px)}22%{opacity:1;filter:blur(0)}100%{scale:1;rotate:-10deg;opacity:1}}
@keyframes b8-blot{0%{transform:scale(.04);opacity:.9}60%{opacity:.45}100%{transform:scale(1);opacity:.14}}
@media (prefers-reduced-motion: reduce){.b8-inkbox{display:none}}
@media (prefers-reduced-motion: reduce){.b8-roll>span,.b8-land{animation:none}}
