/* ---------- window chrome for the desktop 3 layout studies ----------
   one file owns how a window looks. the shell owns where it goes and what
   state it is in; this file owns what that state looks like. eleven borders,
   switched by [data-border] on <html> (or on any ancestor, so a bench can show
   all eleven at once — the same reason themes are [data-theme], not :root):

     hairline  desktop 2 exactly. the control.
     bevel     a flat two-tone bevel: raised frame, sunken well. windows 95 / next.
     notched   a 2px square frame with cut corners and a hard offset shadow.
     tab       the title is a tab sitting on the frame, only as wide as it needs. beos.
     corners   no border at all — the frame is drawn only at its corners, like crop marks.
     notched-tab    notched's cut, carried on a tab; the body keeps the lower-right cut.
     notched-bevel  notched's cut frame lit from the upper left; bevel's buttons, cut.
     notched-bevel-bar  between the two: a lit bar at least 68% wide, title left,
                    every control right, the close in its slanted corner.
     notched-bevel-tab  notched-bevel's lit cut frame with the title on notched-tab's
                    tab — axel's pick for desktop 3.
     notched-cut    the cut corner is still there, in its notch, and it is the close.
     dither         a 1px line and three bands of 4x4 bayer dither falling away from it.

   assumptions, so nothing here fights the shell:
   - .win is already positioned (relative in the grid, absolute when free), as
     desktop 2's .desk>.win is. nothing here sets position, grid or z on .win.
   - chrome text sets no font. every title, bar and label carries .sys, which
     type.css styles per [data-systype].
   - focus is .front. it is shown by a change of fill or tint in every border —
     a shadow may come with it, but never carries it alone.
   - the glyphs are the icons session's kit, set on :root by glyphs.js as 1-bit
     masks. without glyphs.js the plain cde geometry here stands in for them.

   contrast, measured for every pair this file introduces, all five themes,
   in the order night / day / amber / desert / mesa. text owes 4.5; marks and
   control edges owe 3.
     title-fg on --title, front bars, tab and menu highlights   8.08 11.8  10.5  7.56 16.2
     bevel   glyph (fg) on the chrome face                      11.8 15.0  9.00 11.0  13.7
     bevel   inactive title text on face                         8.89 9.40  5.97  7.67  7.89
     bevel   lit edge on face — carries it in dark themes        3.93  ·    3.15  3.75   ·
     bevel   shadow edge on face — carries it in light themes     ·   4.29   ·     ·    4.16
     bevel   text on the pressed dither, darker cell             6.25 9.42  5.48  5.92  8.71
     bevel   hover glyph and focus ring (accent) on face         7.18 4.19  11.4  6.06  4.14
     notched front edge (fg) on desk                            10.2 10.3  11.2  10.3  12.0
     notched inactive edge on desk / on the window ground        4.10/5.93 4.06/6.95 3.68/3.44 3.66/4.89 3.97/5.35
     notched inactive control glyph (fg) on its fill             6.87 10.1  6.59  6.94  9.98
     tab     inactive tab text (dim) on ground                   8.21 6.29  4.56  6.36  4.71
     tab     front frame edge (dim) on desk                      5.98 4.06  5.06  5.17  3.97
     corners front mark (--title) / inactive mark (dim) on bg    8.08/8.64 11.8/6.95 10.5/4.74 7.56/6.91 16.2/5.35
     surfaces: pressed text fg on ground 10.1+, bg on fg 10.5+, dim text on bg 4.74+
   round two, same order:
     notched-tab   inactive tab text (dim) on ground                 8.21 6.29  4.56  6.36  4.71
     notched-bevel lit edge on desk, carrying (dark themes)          3.39  ·    3.91  3.50   ·
     notched-bevel shadow edge on desk, carrying (light, fg 72%)      ·   4.18   ·     ·    5.10
     notched-cut   front piece (--title) on desk / its mark          5.59/8.08 6.86/11.8 11.2/10.5 5.66/7.56 12.0/16.2
     notched-cut   inactive piece (frame edge) on desk / its mark    4.10/5.93 4.06/6.95 3.68/3.44 3.66/4.89 3.97/5.35
     dither        front band (--title) / inactive band (dim) on desk 5.59/5.98 6.86/4.06 11.2/5.06 5.66/5.17 12.0/3.97
     dither        control ring (dim) on bg                          8.64 6.95  4.74  6.91  5.35
     housings      front mark on its block (title on title-fg)       8.08 11.8  10.5  7.56 16.2
   round five, notched-bevel-tab, same order (its pairs are notched-bevel's
   and notched-tab's, now meeting on one window):
     front tab, and the menubar's current word: title-fg on --title   8.08 11.8  10.5  7.56 16.2
     inactive tab text on the chrome face                            8.89 9.40  5.97  7.67  7.89
     lit edge on desk, carrying the outline (dark themes)            3.39  ·    3.91  3.50   ·
     shadow edge on desk, carrying the outline (light, fg 72%)        ·   4.18   ·     ·    5.10
     lit edge on an inactive tab's face                              3.93  ·    3.15  3.75   ·
     control glyphs (fg) on their bevelled blocks                    11.8 15.0  9.00  11.0  13.7
   round eight, notched-bevel-bar: every pair is notched-bevel-tab's above
   (same tokens, same edges) — the bar is the tab made wider. its one new
   surface, the menubar's slanted current word, is title-fg on --title
   (7.56+), and the slanted close is a bevelled block like the others
   (glyph 9.00+, carrying edge 3.39+ / 4.18+).
   an inactive housing's block sits at 1.6–2.1 on the window ground; it is
   found by its mark (fg on the block, 6.59+), like round one's controls.
   the lit edge in light themes and the shadow edge in dark themes sit near
   1.3: they are the half of the bevel that light cannot draw there, and the
   other half carries the edge. known and inherited, not introduced here:
   desktop 2's inactive hairline (--rule) sits at ~1.7 on every desk. the
   window is found by its ground and its title rather than its outline — kept
   as the control, flagged rather than fixed. */

/* ================= shared ================= */
/* the 4x4 bayer matrix as colourless alpha masks, at desktop 2's six levels
   (MASKS: a cell is on where its bayer value is below the level). dither's
   edge and the threshold focus read them. */
:root{
  --bayer-3:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 4' width='4' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h1v1h-1zM2 0h1v1h-1zM2 2h1v1h-1z'/%3E%3C/svg%3E");
  --bayer-6:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 4' width='4' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h1v1h-1zM2 0h1v1h-1zM1 1h1v1h-1zM0 2h1v1h-1zM2 2h1v1h-1zM3 3h1v1h-1z'/%3E%3C/svg%3E");
  --bayer-9:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 4' width='4' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h1v1h-1zM1 0h1v1h-1zM2 0h1v1h-1zM1 1h1v1h-1zM3 1h1v1h-1zM0 2h1v1h-1zM2 2h1v1h-1zM1 3h1v1h-1zM3 3h1v1h-1z'/%3E%3C/svg%3E");
  --bayer-12:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 4' width='4' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h1v1h-1zM1 0h1v1h-1zM2 0h1v1h-1zM3 0h1v1h-1zM1 1h1v1h-1zM3 1h1v1h-1zM0 2h1v1h-1zM1 2h1v1h-1zM2 2h1v1h-1zM3 2h1v1h-1zM1 3h1v1h-1zM3 3h1v1h-1z'/%3E%3C/svg%3E");
  --bayer-16:linear-gradient(#000 0 0);

}
/* layout containment makes every window the containing block for the marks,
   bands and plates the borders draw on its pseudo-elements, whether or not
   the host positions it — the shell's phone layout sets .win static, and a
   corner mark must not escape to the page. the shell's container-type
   already implies it; this says so for any other host. */
:where(.win){display:flex;flex-direction:column;min-width:0;background:var(--bg);contain:layout}
:where(.frame){display:flex;flex-direction:column;min-height:0;flex:1}

/* the title bar is a three-column grid so the name sits in the true centre,
   whatever the corners hold. amiga's rule: close upper-left; minimize (or
   shade) then expand upper-right, expand outermost. never mixed. */
.title{height:var(--title-h,24px);flex:none;display:grid;
  grid-template-columns:minmax(max-content,1fr) minmax(0,auto) minmax(max-content,1fr);
  align-items:center;gap:8px;padding:0 6px;cursor:grab;touch-action:none;user-select:none;position:relative}
.title:active{cursor:grabbing}
.title h2{margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dim);padding:0 8px}
.ctl{display:flex;gap:6px;align-items:center}
.ctl-l{justify-self:start}
.ctl-r{justify-self:end}
.front .title{background:var(--title)}
.front .title h2{color:var(--title-fg)}
/* an overlay sheet holds focus, so its header is a focused title bar: its
   controls take the same treatment as the front window's */

/* a control is a frame (.c-btn) with a replaceable mark inside (.glyph).
   sizes stay odd so an odd glyph centres on whole pixels. */
.c-btn{position:relative;flex:none;width:15px;height:15px;padding:0;
  border:1px solid var(--dim);color:var(--dim);background:var(--bg);--glyph-bg:var(--bg);
  transition:transform var(--t-press,140ms) var(--ease-out,ease),color var(--t-hover,120ms) ease,
    border-color var(--t-hover,120ms) ease,background-color var(--t-hover,120ms) ease}
.c-close{width:13px;height:13px}
.c-btn:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
.title:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
/* on a filled title the accent can be the fill itself (desert's accent is its
   title colour), so focus draws in the title's own ink there */
.front .title:focus-visible,:is(.front .title,.sheet header) .c-btn:focus-visible{outline-color:var(--title-fg)}

/* ---------- glyphs ----------
   the marks are the icons session's kit (d3-icons, 51fe4bf), which glyphs.js
   turns into 1-bit masks on :root: --glyph-<name>-7 and -9 for the
   controls, --close-glyph-7 and -9 for whichever × the study has picked. a
   glyph paints currentColor through its mask at exactly its pixel size, in
   a box of that size centred on whole pixels in its housing. each border
   says which size its housings take: 9 by default, 7 where the housing is
   13px (hairline's and tab's close box), in dither's rings, in notched-cut's
   corner piece, and everywhere at compact density.
   an expanded window's button shows contract — the four corners turned in.
   without glyphs.js the css-drawn cde geometry below stands in: --glyph-ph
   hides it once the kit is there, and --glyph-ink is what inks the masks. */
.glyph{position:absolute;inset:0;margin:auto;display:block;pointer-events:none;font-style:normal;
  --gsz:9px;--gimg:var(--g9);width:var(--gsz);height:var(--gsz);
  background:var(--glyph-ink,transparent);
  -webkit-mask:var(--gimg,none) center/var(--gsz) var(--gsz) no-repeat;
          mask:var(--gimg,none) center/var(--gsz) var(--gsz) no-repeat}
.glyph[data-glyph=close],.c-close .glyph{--g7:var(--close-glyph-7);--g9:var(--close-glyph-9)}
.glyph[data-glyph=shade]{--g7:var(--glyph-shade-7);--g9:var(--glyph-shade-9)}
.glyph[data-glyph=minimize]{--g7:var(--glyph-minimize-7);--g9:var(--glyph-minimize-9)}
.glyph[data-glyph=expand]{--g7:var(--glyph-expand-7);--g9:var(--glyph-expand-9)}
.glyph:is([data-glyph=contract],[data-glyph=restore]),
.c-expand[aria-pressed=true] .glyph{--g7:var(--glyph-contract-7);--g9:var(--glyph-contract-9)}
.glyph[data-glyph=info]{--g7:var(--glyph-info-7);--g9:var(--glyph-info-9)}
/* the 7px housings */
[data-density=compact] .glyph,
[data-border=hairline] .c-close .glyph,[data-border=tab] .c-close .glyph,
[data-border=dither] .glyph{--gsz:7px;--gimg:var(--g7)}

/* fallback only — the cde placeholders, for a page without glyphs.js: a
   square to close, a bar to shade, a short low bar to minimize, a
   heavy-topped square to expand, two squares to restore, an i. */
.glyph::before,.glyph::after{content:'';position:absolute;box-sizing:border-box;display:var(--glyph-ph,block)}
.glyph[data-glyph=close]::before{inset:1px;border:1px solid currentColor}
.glyph[data-glyph=shade]::before{left:0;right:0;top:1px;height:2px;background:currentColor}
.glyph[data-glyph=shade]::after{left:0;right:0;top:5px;height:1px;background:currentColor;opacity:.55}
.glyph[data-glyph=minimize]::before{left:1px;bottom:0;width:5px;height:2px;background:currentColor}
.glyph[data-glyph=expand]::before{inset:0;border:1px solid currentColor;border-top-width:2px}
.glyph:is([data-glyph=restore],[data-glyph=contract])::before,
.c-expand[aria-pressed=true] .glyph[data-glyph=expand]::before{inset:0 0 auto auto;width:6px;height:6px;border:1px solid currentColor;border-top-width:2px}
.glyph:is([data-glyph=restore],[data-glyph=contract])::after,
.c-expand[aria-pressed=true] .glyph[data-glyph=expand]::after{left:0;bottom:0;width:6px;height:6px;border:1px solid currentColor;border-top-width:2px;background:var(--glyph-bg)}
.glyph[data-glyph=info]::before{left:4px;top:0;width:1px;height:2px;background:currentColor}
.glyph[data-glyph=info]::after{left:3px;top:3px;width:3px;height:6px;border-bottom:1px solid currentColor;
  background:linear-gradient(currentColor,currentColor) center top/1px 5px no-repeat}

/* press is set from pointerdown (data-pressing) or :active, so a held key
   never replays it */
.c-btn[data-pressing],.c-btn:active{transform:scale(.9)}

/* touch: the control keeps its drawn size and an invisible ::before takes the
   hit area out to ~43px, as desktop 2 does */
@media (pointer:coarse){
  .title{min-height:44px}
  .c-btn::before{content:'';position:absolute;inset:-14px}
  .ctl{gap:14px}
}
@media (prefers-reduced-motion:reduce){
  .c-btn{transition:none}
  .c-btn[data-pressing],.c-btn:active{transform:none}
}

/* ---------- surfaces: the bars wear the same language as the windows ----------
   .surface is a raised panel (menubar, taskbar, dock, pop-up menu, sheet).
   [data-edge=top|bottom] says it is pinned to that edge of the viewport, so
   only its inward edge is drawn (the shell's .bar and .taskbar count as
   pinned without it). .surface-btn is a button that lives on one. */
.surface{background:var(--bg);color:var(--fg)}
.surface-btn{color:var(--dim);background:transparent;border:1px solid transparent;
  transition:color var(--t-hover,120ms) ease,background-color var(--t-hover,120ms) ease,border-color var(--t-hover,120ms) ease}
.surface-btn[aria-pressed=true],.surface-btn[aria-current=true]{color:var(--fg)}
.surface-btn:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
@media (hover:hover){.surface-btn:hover{color:var(--fg)}}

/* ================= hairline — desktop 2, the control ================= */
[data-border=hairline] .win{border:1px solid var(--rule);padding:3px;border-radius:5px}
[data-border=hairline] .frame{border:1px solid var(--rule);border-radius:3px}
[data-border=hairline] .title{border-bottom:1px solid var(--rule)}
/* only the focused window casts; an unfocused one is flat */
[data-border=hairline] .win.front{box-shadow:0 18px 40px -28px color-mix(in srgb,#000 85%,transparent)}
[data-border=hairline] .win.front,[data-border=hairline] .front .frame,[data-border=hairline] .front .title{border-color:var(--dim)}
[data-border=hairline] .win[data-state=shaded] .title{border-bottom-color:transparent}
/* the close box is the button's own frame. with the kit, the 7px × sits in
   it, 2px in; without it, the box is empty and a hover fills it, as desktop 2 */
[data-border=hairline] .c-close .glyph{inset:2px;width:auto;height:auto}
[data-border=hairline] .c-close .glyph::before{display:none}
[data-border=hairline] :is(.front .title,.sheet header) .c-btn{border-color:var(--title-fg);color:var(--title-fg);background:transparent;--glyph-bg:var(--title)}
@media (hover:hover){
  [data-border=hairline] .c-btn:hover{border-color:var(--accent);color:var(--accent)}
  [data-border=hairline] .c-close:hover .glyph{background:var(--accent)}
  [data-border=hairline] :is(.front .title,.sheet header) .c-btn:hover{border-color:var(--title-fg);color:var(--title);background:var(--title-fg);--glyph-bg:var(--title-fg)}
  [data-border=hairline] :is(.front .title,.sheet header) .c-close:hover .glyph{background:var(--title)}
}
[data-border=hairline] .surface{border:1px solid var(--rule);box-shadow:inset 0 1px 0 color-mix(in srgb,var(--fg) 14%,transparent)}
[data-border=hairline] .surface:is([data-edge=top],.bar){border-width:0 0 1px;box-shadow:none}
[data-border=hairline] .surface:is([data-edge=bottom],.taskbar){border-width:1px 0 0}
[data-border=hairline] .surface-btn{border-radius:3px}
[data-border=hairline] .surface-btn[aria-pressed=true],
[data-border=hairline] .surface-btn[aria-current=true]{background:var(--ground);border-color:var(--dim)}
@media (hover:hover){[data-border=hairline] .surface-btn:hover{background:var(--ground)}}

/* ================= bevel — raised frame, sunken well =================
   windows 95 and next drew light from the upper left: a lit edge top-left, a
   shadow edge bottom-right, two tones and no gradient. the frame is raised
   out of the desk and the contents sit in a well sunk into it.
   a dark theme can't draw a shadow darker than near-black, so there the bevel
   is carried by its lit edge; in a light theme, by its shadow edge. that is
   how light behaves on a dark object anyway. */
:is([data-border$=bevel],[data-border$=bevel-tab],[data-border$=bevel-bar]) :is(.win,.surface,.surface-btn){
  --bv-face:color-mix(in srgb,var(--fg) 9%,var(--bg));
  --bv-hi:color-mix(in srgb,var(--fg) 48%,var(--bv-face));
  --bv-lo:color-mix(in srgb,#000 75%,var(--bg));
  --bv-press:color-mix(in srgb,var(--fg) 22%,var(--bv-face));
  --bv-text-off:color-mix(in srgb,var(--fg) 45%,var(--dim))}
:is([data-border$=bevel],[data-border$=bevel-tab],[data-border$=bevel-bar]) :is(.win,.surface,.surface-btn):is([data-theme=day] *,[data-theme=mesa] *){
  --bv-face:color-mix(in srgb,var(--fg) 8%,var(--bg));
  --bv-hi:color-mix(in srgb,#fff 85%,var(--bg));
  --bv-lo:color-mix(in srgb,var(--fg) 62%,var(--bg))}
[data-border=bevel] .win{background:var(--bv-face);border:2px solid;border-color:var(--bv-hi) var(--bv-lo) var(--bv-lo) var(--bv-hi);
  padding:2px;border-radius:0}
/* the well: 1px padding keeps a flush canvas from painting over its edge */
[data-border=bevel] .frame{background:var(--bg);padding:1px;box-shadow:inset 1px 1px 0 var(--bv-lo),inset -1px -1px 0 var(--bv-hi)}
/* the bar covers the well's top and ends in a 2px face gap and the well's
   shadow line, all inside itself, so no content below can paint over it */
[data-border=bevel] .title{margin:-1px -1px 0;height:calc(var(--title-h,24px) + 3px);padding-bottom:3px;
  background-color:var(--bv-face);
  background-image:linear-gradient(to top,var(--bv-lo) 0 1px,var(--bv-face) 1px 3px,transparent 3px)}
[data-border=bevel] .title h2{color:var(--bv-text-off)}
[data-border=bevel] .front .title{background-color:var(--title)}
[data-border=bevel] .front .title h2{color:var(--title-fg)}
[data-border=bevel] .win[data-state=shaded] .frame{padding:0;background:transparent;box-shadow:none}
[data-border=bevel] .win[data-state=shaded] .title{margin:0;height:var(--title-h,24px);padding-bottom:0;background-image:none}
/* buttons are small raised blocks; pressed, the bevel flips and the mark
   drops a pixel — the press is in the light, not in a scale */
[data-border=bevel] .c-btn,[data-border=bevel] .c-close{width:17px;height:15px;background:var(--bv-face);--glyph-bg:var(--bv-face);color:var(--fg);
  border:1px solid;border-color:var(--bv-hi) var(--bv-lo) var(--bv-lo) var(--bv-hi)}
[data-border=bevel] .c-btn:is([data-pressing],:active){transform:none;border-color:var(--bv-lo) var(--bv-hi) var(--bv-hi) var(--bv-lo)}
[data-border=bevel] .c-btn:is([data-pressing],:active) .glyph{transform:translate(1px,1px)}
@media (hover:hover){[data-border=bevel] .c-btn:hover{color:var(--accent)}}
:is([data-border$=bevel],[data-border$=bevel-tab],[data-border$=bevel-bar]) .surface{background:var(--bv-face);border:2px solid;border-color:var(--bv-hi) var(--bv-lo) var(--bv-lo) var(--bv-hi)}
:is([data-border$=bevel],[data-border$=bevel-tab],[data-border$=bevel-bar]) .surface:is([data-edge=top],.bar){border-width:0 0 2px;border-bottom-color:var(--bv-lo);box-shadow:inset 0 -1px 0 color-mix(in srgb,var(--bv-lo) 40%,var(--bv-face))}
/* a pinned bar only has its inward edge, so it draws both tones there: the
   shadow line reads on a light desk, the lit line on a dark one */
:is([data-border$=bevel],[data-border$=bevel-tab],[data-border$=bevel-bar]) .surface:is([data-edge=bottom],.taskbar){border-width:1px 0 0;border-top-color:var(--bv-lo);box-shadow:inset 0 1px 0 var(--bv-hi)}
/* a menubar word is flat until it is pointed at (then it rises) or chosen
   (then it sinks). a taskbar button is always a raised block, because it
   stands for a window. */
:is([data-border$=bevel],[data-border$=bevel-tab],[data-border$=bevel-bar]) .surface-btn{color:var(--fg);background:transparent;border:1px solid transparent}
:is([data-border$=bevel],[data-border$=bevel-tab],[data-border$=bevel-bar]) .surface:is([data-edge=bottom],.taskbar) .surface-btn{background:var(--bv-face);border-color:var(--bv-hi) var(--bv-lo) var(--bv-lo) var(--bv-hi)}
@media (hover:hover){:is([data-border$=bevel],[data-border$=bevel-tab],[data-border$=bevel-bar]) .surface-btn:hover{border-color:var(--bv-hi) var(--bv-lo) var(--bv-lo) var(--bv-hi)}}
/* the pressed taskbar button is windows 95's checkerboard: a 1-bit dither of
   the face and its lit tone, a pixel per cell. the constraint is the look. */
:is([data-border$=bevel],[data-border$=bevel-tab],[data-border$=bevel-bar]) .surface .surface-btn:is([aria-pressed=true],[aria-current=true],:active,[data-pressing]){
  border-color:var(--bv-lo) var(--bv-hi) var(--bv-hi) var(--bv-lo);
  background:repeating-conic-gradient(var(--bv-press) 0 25%,var(--bv-face) 0 50%) 0 0/2px 2px}
/* inside a menu the chosen item is highlighted in the title colour, as the
   old menus did, rather than pressed */
:is([data-border$=bevel],[data-border$=bevel-tab],[data-border$=bevel-bar]) .surface[role=menu] .surface-btn:is([aria-current=true],[aria-pressed=true]){background:var(--title);color:var(--title-fg);border-color:transparent}
@media (hover:hover){:is([data-border$=bevel],[data-border$=bevel-tab],[data-border$=bevel-bar]) .surface[role=menu] .surface-btn:hover{background:var(--title);color:var(--title-fg);border-color:transparent}}

/* ================= the notched family — square, cut, and casting hard =================
   notched is the base, and notched-tab, notched-bevel and notched-cut are built
   on it: [data-border^=notched] matches all four, and each variant overrides
   only what it changes.
   a heavier 2px frame with two corners cut — upper left and lower right, the
   way a reader enters and leaves — and a hard offset shadow with no blur on
   the front window only. clip-path would clip a box-shadow, so the cut is on
   the frame, the 2px edge is a ring drawn over it (an evenodd polygon), and
   the shadow is a drop-shadow on the unclipped window around them. its offset
   is --nt-sh, less a lean (--nt-lx/--nt-ly), which only notched-cut feeds. */
[data-border^=notched] .win{
  --nt:12px;--nt-w:2px;--nt-tl:var(--nt);--nt-tr:0px;--nt-br:var(--nt);--nt-bl:0px;
  --nt-edge:color-mix(in srgb,var(--dim) 80%,var(--bg));
  --nt-sh:6px;--nt-sh-c:var(--title);--nt-lx:0px;--nt-ly:0px;
  --nt-a-tl:max(var(--nt-w),calc(var(--nt-tl) + var(--nt-w) * .414));
  --nt-a-tr:max(var(--nt-w),calc(var(--nt-tr) + var(--nt-w) * .414));
  --nt-a-br:max(var(--nt-w),calc(var(--nt-br) + var(--nt-w) * .414));
  --nt-a-bl:max(var(--nt-w),calc(var(--nt-bl) + var(--nt-w) * .414));
  --nt-outer:var(--nt-tl) 0,calc(100% - var(--nt-tr)) 0,100% var(--nt-tr),100% calc(100% - var(--nt-br)),
    calc(100% - var(--nt-br)) 100%,var(--nt-bl) 100%,0 calc(100% - var(--nt-bl)),0 var(--nt-tl);
  --nt-inner:var(--nt-a-tl) var(--nt-w),calc(100% - var(--nt-a-tr)) var(--nt-w),calc(100% - var(--nt-w)) var(--nt-a-tr),
    calc(100% - var(--nt-w)) calc(100% - var(--nt-a-br)),calc(100% - var(--nt-a-br)) calc(100% - var(--nt-w)),
    var(--nt-a-bl) calc(100% - var(--nt-w)),var(--nt-w) calc(100% - var(--nt-a-bl)),var(--nt-w) var(--nt-a-tl);
  background:transparent;border:0;padding:0;border-radius:0;box-shadow:none}
[data-border^=notched] .win:is([data-theme=day] *,[data-theme=mesa] *){--nt-edge:var(--dim)}
[data-border^=notched] .win.front{--nt-edge:var(--fg);
  filter:drop-shadow(calc(var(--nt-sh) - var(--nt-lx)) calc(var(--nt-sh) - var(--nt-ly)) 0 var(--nt-sh-c))}
[data-border^=notched] .frame{position:relative;background:var(--bg);clip-path:polygon(var(--nt-outer))}
[data-border^=notched] .frame::after{content:'';position:absolute;inset:0;z-index:3;pointer-events:none;background:var(--nt-edge);
  clip-path:polygon(evenodd,var(--nt-outer),var(--nt-tl) 0,var(--nt-inner),var(--nt-a-tl) var(--nt-w))}
[data-border^=notched] .title{padding-left:4px;padding-right:calc(var(--nt-tr) * .6 + 6px);border-bottom:var(--nt-w) solid var(--nt-edge)}
[data-border^=notched] .win[data-state=shaded] .title{border-bottom-color:transparent}
[data-border^=notched] .win[data-state=shaded]{--nt:9px}

/* ---------- controls: cut blocks ----------
   every control is a block with the same cut in miniature, painted rather
   than clipped — a clip would also clip the invisible 44px touch target. one
   painter serves the family: --cb-c is the cut, --cb-fill the block, and
   --cb-hi/--cb-lo its two edges, which only notched-bevel makes differ from
   the fill (and which a front hover uses to leave just the outline). */
[data-border^=notched] .c-btn{width:15px;height:15px;border:0;padding:0;
  --cb-c:3px;--cb-fill:color-mix(in srgb,var(--dim) 35%,var(--bg));--cb-hi:var(--cb-fill);--cb-lo:var(--cb-fill);
  --glyph-bg:var(--cb-fill);color:var(--fg);
  background:
    linear-gradient(135deg,transparent 0 calc(var(--cb-c) * .7071),var(--cb-hi) 0 calc(var(--cb-c) * .7071 + 1px),transparent 0),
    linear-gradient(var(--cb-hi),var(--cb-hi)) var(--cb-c) 0/calc(100% - var(--cb-c)) 1px no-repeat,
    linear-gradient(var(--cb-hi),var(--cb-hi)) 0 var(--cb-c)/1px calc(100% - var(--cb-c)) no-repeat,
    linear-gradient(var(--cb-lo),var(--cb-lo)) 100% 0/1px 100% no-repeat,
    linear-gradient(var(--cb-lo),var(--cb-lo)) 0 100%/100% 1px no-repeat,
    linear-gradient(135deg,transparent 0 calc(var(--cb-c) * .7071),var(--cb-fill) 0)}
[data-border^=notched] :is(.front .title,.sheet header) .c-btn{--cb-fill:var(--title-fg);color:var(--title)}
[data-border^=notched] .c-btn:is([data-pressing],:active){transform:translate(1px,1px)}
@media (hover:hover){
  [data-border^=notched] .c-btn:hover{--cb-fill:var(--fg);color:var(--bg)}
  /* on a filled bar the block empties to its own cut outline: inverting it
     would be invisible in day and mesa, where the title's ink is the ground */
  [data-border^=notched] :is(.front .title,.sheet header) .c-btn:hover{--cb-fill:transparent;--cb-hi:var(--title-fg);--cb-lo:var(--title-fg);
    --glyph-bg:var(--title);color:var(--title-fg)}
}

/* ---------- the close housing ----------
   axel: the little square close doesn't fit. here the close is a wedge that
   nests into the window's own cut — its cut runs parallel to the frame's,
   two pixels off it, so the control is shaped by the corner it sits in. it
   holds the 9px ×, 3px in from its right edge and centred top to bottom,
   clear of its own cut (7px at compact density). */
[data-border^=notched] .c-close{width:21px;height:15px;--cb-c:9px}
[data-border^=notched] .c-close .glyph{inset:0 3px 0 auto;margin:auto 0}

/* surfaces don't take the cut: the dock's labels and a menu's items hang
   outside their panel, and a clip would cut them off. square, 2px, hard.
   notched-bevel wears bevel's surfaces instead (see bevel). */
:is([data-border=notched],[data-border=notched-tab],[data-border=notched-cut]) .surface{border:2px solid color-mix(in srgb,var(--dim) 80%,var(--bg));box-shadow:5px 5px 0 var(--title)}
:is([data-border=notched],[data-border=notched-tab],[data-border=notched-cut]) .surface:is([data-theme=day] *,[data-theme=mesa] *){border-color:var(--dim)}
:is([data-border=notched],[data-border=notched-tab],[data-border=notched-cut]) .surface:is([data-edge],.bar,.taskbar){box-shadow:none;border-width:0}
:is([data-border=notched],[data-border=notched-tab],[data-border=notched-cut]) .surface:is([data-edge=top],.bar){border-bottom:2px solid var(--fg)}
:is([data-border=notched],[data-border=notched-tab],[data-border=notched-cut]) .surface:is([data-edge=bottom],.taskbar){border-top:2px solid var(--fg)}
:is([data-border=notched],[data-border=notched-tab],[data-border=notched-cut]) .surface-btn{border-width:2px}
:is([data-border=notched],[data-border=notched-cut]) .surface-btn:is([aria-pressed=true],[aria-current=true]){background:var(--fg);color:var(--bg);border-color:var(--fg)}
@media (hover:hover){:is([data-border=notched],[data-border=notched-tab],[data-border=notched-cut]) .surface-btn:not([aria-pressed=true]):not([aria-current=true]):hover{border-color:var(--dim)}}

/* ================= notched-tab — the cut rides on a tab =================
   notched and tab together: the title leaves the frame as a tab, and the tab
   carries the cut — upper left, with a smaller one on its upper right — while
   the body keeps notched's lower-right cut. the frame's top edge runs out from
   under the tab, so the outline is two cut pieces joined, and no two windows
   share it. the tab's fill and edge are pseudo-elements with the tab's shape,
   not a clip on the bar, so the controls keep their touch targets. */
[data-border=notched-tab] .win{--tab-h:var(--title-h,24px);--nt-tl:10px;--nt-tr:6px;--nt-t:calc(var(--tab-h) - var(--nt-w));--nt-tab-b:100%;--veil:var(--ground)}
@media (pointer:coarse){[data-border=notched-tab] .win{--tab-h:max(44px,var(--title-h,24px))}}
[data-border=notched-tab] .win[data-state=shaded]{--nt:12px;--nt-tab-b:calc(100% - var(--nt-w))}
[data-border=notched-tab] .frame{background:linear-gradient(transparent 0 var(--nt-t),var(--bg) 0);
  clip-path:polygon(0 0,100% 0,100% calc(100% - var(--nt-br)),calc(100% - var(--nt-br)) 100%,0 100%)}
[data-border=notched-tab] .frame::after{clip-path:polygon(evenodd,
  0 var(--nt-t),100% var(--nt-t),100% calc(100% - var(--nt-br)),calc(100% - var(--nt-br)) 100%,0 100%,0 var(--nt-t),
  var(--nt-w) calc(var(--nt-t) + var(--nt-w)),calc(100% - var(--nt-w)) calc(var(--nt-t) + var(--nt-w)),
  calc(100% - var(--nt-w)) calc(100% - var(--nt-a-br)),calc(100% - var(--nt-a-br)) calc(100% - var(--nt-w)),
  var(--nt-w) calc(100% - var(--nt-w)),var(--nt-w) calc(var(--nt-t) + var(--nt-w)))}
[data-border=notched-tab] .title{--nt-tab:polygon(var(--nt-tl) 0,calc(100% - var(--nt-tr)) 0,100% var(--nt-tr),100% 100%,0 100%,0 var(--nt-tl));
  align-self:flex-start;max-width:100%;height:var(--tab-h);min-height:0;
  grid-template-columns:max-content minmax(0,auto) max-content;
  padding-right:calc(var(--nt-tr) + 5px);background:transparent;border-bottom:0}
[data-border=notched-tab] .front .title{background:transparent}
[data-border=notched-tab] .title::before{content:'';position:absolute;inset:0;z-index:-1;background:var(--ground);clip-path:var(--nt-tab)}
[data-border=notched-tab] .front .title::before{background:var(--title)}
[data-border=notched-tab] .title::after{content:'';position:absolute;inset:0;z-index:2;pointer-events:none;background:var(--nt-edge);
  clip-path:polygon(evenodd,
    var(--nt-tl) 0,calc(100% - var(--nt-tr)) 0,100% var(--nt-tr),100% 100%,0 100%,0 var(--nt-tl),var(--nt-tl) 0,
    var(--nt-a-tl) var(--nt-w),calc(100% - var(--nt-a-tr)) var(--nt-w),calc(100% - var(--nt-w)) var(--nt-a-tr),
    calc(100% - var(--nt-w)) var(--nt-tab-b),var(--nt-w) var(--nt-tab-b),var(--nt-w) var(--nt-a-tl),var(--nt-a-tl) var(--nt-w))}
[data-border=notched-tab] .win[data-state=shaded] .frame{background:transparent;clip-path:none}
[data-border=notched-tab] .win[data-state=shaded] .frame::after{display:none}
/* expanded, the strip beside the tab is desk, not a hole (see tab) */
[data-border=notched-tab] .win:is([data-state=expanded],[data-raised]) .frame{background:linear-gradient(var(--desk) 0 var(--nt-t),var(--bg) 0)}
[data-border=notched-tab] .surface-btn:is([aria-pressed=true],[aria-current=true]){background:var(--title);color:var(--title-fg);border-color:var(--fg)}

/* ================= notched-bevel — the cut, lit from the upper left =================
   notched and bevel together: the cut-corner frame keeps its 2px, but the
   2px is two tones — the lit half runs up the left, across the cut and along
   the top; the shadow half takes the rest — and the title sits in a groove.
   because the light comes from the upper left, the hard shadow falls lower
   right in the shadow tone, not in the title colour. buttons are bevel's,
   with the cut: raised, and pressed in when pressed. */
[data-border=notched-bevel] .win{--nt-w:2px;--nt-edge:var(--bv-lo);--nt-sh:4px;--nt-sh-c:var(--bv-lo);--veil:var(--bv-face)}
[data-border=notched-bevel] .win.front{--nt-edge:var(--bv-lo)}
/* in a light theme the shadow half carries the edge against the desk, so it
   is drawn darker than bevel's own shadow tone (which measured 2.94 on day's sky) */
[data-border=notched-bevel] .win:is([data-theme=day] *,[data-theme=mesa] *){--nt-edge:color-mix(in srgb,var(--fg) 72%,var(--bg));--nt-sh-c:var(--nt-edge)}
[data-border=notched-bevel] .frame::before{content:'';position:absolute;inset:0;z-index:4;pointer-events:none;background:var(--bv-hi);
  clip-path:polygon(0 100%,0 var(--nt-tl),var(--nt-tl) 0,100% 0,calc(100% - var(--nt-w)) var(--nt-w),
    var(--nt-a-tl) var(--nt-w),var(--nt-w) var(--nt-a-tl),var(--nt-w) calc(100% - var(--nt-w)))}
[data-border=notched-bevel] .title{background:var(--bv-face);border-bottom:1px solid var(--bv-lo);box-shadow:0 1px 0 var(--bv-hi)}
[data-border=notched-bevel] .front .title{background:var(--title)}
[data-border=notched-bevel] .title h2{color:var(--bv-text-off)}
[data-border=notched-bevel] .front .title h2{color:var(--title-fg)}
[data-border=notched-bevel] .win[data-state=shaded] .title{border-bottom-color:transparent;box-shadow:none}
/* buttons (notched-bevel and notched-bevel-tab share them) */
:is([data-border=notched-bevel],[data-border=notched-bevel-tab],[data-border=notched-bevel-bar]) .c-btn,
:is([data-border=notched-bevel],[data-border=notched-bevel-tab],[data-border=notched-bevel-bar]) :is(.front .title,.sheet header) .c-btn{--cb-fill:var(--bv-face);--cb-hi:var(--bv-hi);--cb-lo:var(--bv-lo);color:var(--fg)}
:is([data-border=notched-bevel],[data-border=notched-bevel-tab],[data-border=notched-bevel-bar]) .c-btn:is([data-pressing],:active){transform:none;--cb-hi:var(--bv-lo);--cb-lo:var(--bv-hi)}
:is([data-border=notched-bevel],[data-border=notched-bevel-tab],[data-border=notched-bevel-bar]) .c-btn:is([data-pressing],:active) .glyph{transform:translate(1px,1px)}
@media (hover:hover){
  :is([data-border=notched-bevel],[data-border=notched-bevel-tab],[data-border=notched-bevel-bar]) .c-btn:hover,
  :is([data-border=notched-bevel],[data-border=notched-bevel-tab],[data-border=notched-bevel-bar]) :is(.front .title,.sheet header) .c-btn:hover{--cb-fill:var(--bv-face);--cb-hi:var(--bv-hi);--cb-lo:var(--bv-lo);color:var(--accent)}
}

/* ================= notched-bevel-bar — between the tab and the full bar =================
   axel, round 8: "maybe we could make a appearance look window C option
   that is between notched bevel tab and notched bevel where it takes up
   more width than tab but not quite the entire width of the window? id be
   curious to try moving all the buttons to the right and keep the title of
   the window on the left. the X could have its unique shape in the right
   side corner where it might be slanted."
   so: notched-bevel-tab's lit body and groove, but the title rides a bar at
   least 68% of the window wide (as wide as its contents if that is more).
   the bar keeps the family's upper-left cut, and its right end is cut on a
   slant, one across for every two down. the title sits at the left; every
   control sits at the right — tools, minimize, expand, and the close
   outermost, in the slanted corner, its own right side cut parallel to the
   bar's, two pixels off it.
   this one border breaks the fixed-corner grammar (close upper-left) by
   axel's ask. it does it in css alone — flex order, not a changed dom — so
   the close is still first in the tab order even though it draws last. */
[data-border=notched-bevel-bar] .win{--tab-h:var(--title-h,24px);--nt-tl:10px;--nbt-t:var(--tab-h);--nbt-bb:1px;
  --nbb-s:calc(var(--tab-h) / 2);--nbb-hh:15px;
  --nt-edge:var(--bv-lo);--nt-sh:4px;--nt-sh-c:var(--bv-lo);--veil:var(--bv-face)}
[data-border=notched-bevel-bar] .win.front{--nt-edge:var(--bv-lo)}
[data-border=notched-bevel-bar] .win:is([data-theme=day] *,[data-theme=mesa] *){--nt-edge:color-mix(in srgb,var(--fg) 72%,var(--bg));--nt-sh-c:var(--nt-edge)}
@media (pointer:coarse){[data-border=notched-bevel-bar] .win{--tab-h:max(44px,var(--title-h,24px))}}
[data-border=notched-bevel-bar] .win[data-state=shaded]{--nt:12px;--nbt-bb:var(--nt-w)}
/* the body is notched-bevel-tab's: clipped at the lower right, lit top and left */
[data-border=notched-bevel-bar] .frame{background:linear-gradient(transparent 0 var(--nbt-t),var(--bg) 0);
  clip-path:polygon(0 0,100% 0,100% calc(100% - var(--nt-br)),calc(100% - var(--nt-br)) 100%,0 100%)}
[data-border=notched-bevel-bar] .frame::after{clip-path:polygon(evenodd,
  0 var(--nbt-t),100% var(--nbt-t),100% calc(100% - var(--nt-br)),calc(100% - var(--nt-br)) 100%,0 100%,0 var(--nbt-t),
  var(--nt-w) calc(var(--nbt-t) + var(--nt-w)),calc(100% - var(--nt-w)) calc(var(--nbt-t) + var(--nt-w)),
  calc(100% - var(--nt-w)) calc(100% - var(--nt-a-br)),calc(100% - var(--nt-a-br)) calc(100% - var(--nt-w)),
  var(--nt-w) calc(100% - var(--nt-w)),var(--nt-w) calc(var(--nbt-t) + var(--nt-w)))}
[data-border=notched-bevel-bar] .frame::before{content:'';position:absolute;inset:0;z-index:4;pointer-events:none;background:var(--bv-hi);
  clip-path:polygon(0 100%,0 var(--nbt-t),100% var(--nbt-t),calc(100% - var(--nt-w)) calc(var(--nbt-t) + var(--nt-w)),
    var(--nt-w) calc(var(--nbt-t) + var(--nt-w)),var(--nt-w) calc(100% - var(--nt-w)))}
/* the bar. its slant runs one across for two down, so an edge 2px thick
   moves 2.24px across (2/cos 26.57°) — the inner points below are exact */
[data-border=notched-bevel-bar] .title,[data-border=notched-bevel-bar] .front .title{
  --nbb-shape:polygon(var(--nt-tl) 0,calc(100% - var(--nbb-s)) 0,100% 100%,0 100%,0 var(--nt-tl));
  display:flex;align-items:center;gap:6px;align-self:flex-start;width:fit-content;min-width:68%;max-width:100%;
  height:var(--tab-h);min-height:0;padding:0 calc(var(--tab-h) / 4 - var(--nbb-hh) / 4 + 4.24px) 0 11px;
  background:transparent;border-bottom:0;box-shadow:none}
[data-border=notched-bevel-bar] .title h2{order:1;margin:0 auto 0 0;padding:0 10px 0 0;text-align:left;color:var(--bv-text-off)}
[data-border=notched-bevel-bar] .front .title h2{color:var(--title-fg)}
[data-border=notched-bevel-bar] .title .ctl-r{order:2}
[data-border=notched-bevel-bar] .title .ctl-l{order:3}
[data-border=notched-bevel-bar] .title::before{content:'';position:absolute;inset:0;z-index:-1;background:var(--bv-face);clip-path:var(--nbb-shape)}
[data-border=notched-bevel-bar] .front .title::before{background:var(--title)}
/* the bar's shadow ring: the whole outline with a 1px groove along its base */
[data-border=notched-bevel-bar] .title::after{content:'';position:absolute;inset:0;z-index:2;pointer-events:none;background:var(--nt-edge);
  clip-path:polygon(evenodd,
    var(--nt-tl) 0,calc(100% - var(--nbb-s)) 0,100% 100%,0 100%,0 var(--nt-tl),var(--nt-tl) 0,
    var(--nt-a-tl) var(--nt-w),calc(100% - var(--nbb-s) - 1.24px) var(--nt-w),
    calc(100% - var(--nbt-bb) / 2 - 2.24px) calc(100% - var(--nbt-bb)),
    var(--nt-w) calc(100% - var(--nbt-bb)),var(--nt-w) var(--nt-a-tl),var(--nt-a-tl) var(--nt-w))}
/* the bar's lit half: up the left, across the cut, along the top to the slant */
[data-border=notched-bevel-bar] .title h2::after{content:'';position:absolute;inset:0;z-index:3;pointer-events:none;background:var(--bv-hi);
  clip-path:polygon(0 calc(100% - var(--nbt-bb)),0 var(--nt-tl),var(--nt-tl) 0,calc(100% - var(--nbb-s)) 0,
    calc(100% - var(--nbb-s) - 1.24px) var(--nt-w),var(--nt-a-tl) var(--nt-w),var(--nt-w) var(--nt-a-tl),var(--nt-w) calc(100% - var(--nbt-bb)))}
[data-border=notched-bevel-bar] .win[data-state=shaded] .frame{background:transparent;clip-path:none}
[data-border=notched-bevel-bar] .win[data-state=shaded] .frame::before,
[data-border=notched-bevel-bar] .win[data-state=shaded] .frame::after{display:none}
[data-border=notched-bevel-bar] .win:is([data-state=expanded],[data-raised]) .frame{background:linear-gradient(var(--desk) 0 var(--nbt-t),var(--bg) 0)}
/* the close, in the slanted corner: a bevelled block whose right side is cut
   parallel to the bar's slant (63.43° is the slant's normal; the boundary
   sits at 0.8944 of the block's width along it, through its lower-right
   corner). painted, not clipped, so its 44px touch target stays whole. */
[data-border=notched-bevel-bar] .c-close{--hw:21px;--hh:var(--nbb-hh);--k:calc(var(--hw) * .8944);width:var(--hw);height:var(--hh);
  background:
    linear-gradient(63.43deg,transparent 0 calc(var(--k) - 1px),var(--cb-lo) 0 var(--k),transparent 0),
    linear-gradient(var(--cb-hi),var(--cb-hi)) 0 0/calc(var(--hw) - var(--hh) / 2) 1px no-repeat,
    linear-gradient(var(--cb-hi),var(--cb-hi)) 0 0/1px 100% no-repeat,
    linear-gradient(var(--cb-lo),var(--cb-lo)) 0 100%/100% 1px no-repeat,
    linear-gradient(63.43deg,var(--cb-fill) 0 var(--k),transparent 0)}
[data-border=notched-bevel-bar] .c-close .glyph{inset:0 auto 0 3px;margin:auto 0}
/* oct 5 comparison, scoped to this bar only. two adjacent groups read as one
   left cluster: close, tools, shade, expand, then title. the DOM stays in that
   keyboard order. absent/right retains round 8's right-controls drawing. */
[data-border=notched-bevel-bar][data-barcontrols=left] .title{padding-left:4px;padding-right:calc(var(--nbb-s) + 6px)}
[data-border=notched-bevel-bar][data-barcontrols=left] .title .ctl-l{order:0}
[data-border=notched-bevel-bar][data-barcontrols=left] .title .ctl-r{order:1}
[data-border=notched-bevel-bar][data-barcontrols=left] .title h2{order:2;flex:1 1 auto;margin:0;padding:0 0 0 4px}
/* the close nests in the left cut again, rather than the right slant */
[data-border=notched-bevel-bar][data-barcontrols=left] .c-close{background:
  linear-gradient(135deg,transparent 0 calc(var(--cb-c) * .7071),var(--cb-hi) 0 calc(var(--cb-c) * .7071 + 1px),transparent 0),
  linear-gradient(var(--cb-hi),var(--cb-hi)) var(--cb-c) 0/calc(100% - var(--cb-c)) 1px no-repeat,
  linear-gradient(var(--cb-hi),var(--cb-hi)) 0 var(--cb-c)/1px calc(100% - var(--cb-c)) no-repeat,
  linear-gradient(var(--cb-lo),var(--cb-lo)) 100% 0/1px 100% no-repeat,
  linear-gradient(var(--cb-lo),var(--cb-lo)) 0 100%/100% 1px no-repeat,
  linear-gradient(135deg,transparent 0 calc(var(--cb-c) * .7071),var(--cb-fill) 0)}
[data-border=notched-bevel-bar][data-barcontrols=left] .c-close .glyph{inset:0 3px 0 auto}
@media (pointer:coarse){
  /* keep the pixel housings but separate their expanded hit areas. */
  [data-border=notched-bevel-bar][data-barcontrols=left] .title{padding-left:16px;padding-right:calc(var(--nbb-s) + 2px)}
  [data-border=notched-bevel-bar][data-barcontrols=left] .title .ctl{gap:29px}
  [data-border=notched-bevel-bar][data-barcontrols=left] .title .ctl-l{margin-right:23px}
  [data-border=notched-bevel-bar][data-barcontrols=left] .title h2{margin-left:6px}
  /* Four controls leave less title room at 320px; keep every touch target intact. */
  [data-border=notched-bevel-bar][data-barcontrols=left] .title:has(.c-tool) h2{margin-left:4px}
}
/* the menubar's current word is a little bar of the same kind: the title
   colour, its right end cut on the same slant */
[data-border=notched-bevel-bar] .surface:is([data-edge=top],.bar) .surface-btn:is([aria-current=true],[aria-pressed=true]){
  background:var(--title);color:var(--title-fg);border-color:transparent;padding-right:12px;
  clip-path:polygon(0 0,calc(100% - 10px) 0,100% 100%,0 100%)}

/* ================= notched-bevel-tab — axel's pick for desktop 3 =================
   axel, 2026-09-27: "i love something between notched bezel and maybe
   elements of notched tab too." our reading, pending his confirmation of the
   split: notched-bevel's lit cut frame, with the title carried on
   notched-tab's tab. one light falls on both pieces from the upper left: the
   tab and the body are each ringed in bevel's two tones — lit up the left,
   across the upper cut and along the top; shadowed down the right, across
   the tab's small upper-right cut and the body's lower-right one. the tab's
   base is a shadow line resting on the body's lit top edge, so the title
   sits in a groove, as in notched-bevel, and the hard shadow falls lower
   right in the shadow tone, following both pieces. no two windows share an
   outline, because the tab is as wide as its name.
   the tab's fill, shadow ring and lit band are three pseudo-elements with
   the tab's shape (title::before, title::after, h2::after), not a clip on the
   bar, so the controls keep their touch targets; the body's two tones are
   frame::before and frame::after. */
[data-border=notched-bevel-tab] .win{--tab-h:var(--title-h,24px);--nt-tl:10px;--nt-tr:6px;--nbt-t:var(--tab-h);--nbt-bb:1px;
  --nt-edge:var(--bv-lo);--nt-sh:4px;--nt-sh-c:var(--bv-lo);--veil:var(--bv-face)}
[data-border=notched-bevel-tab] .win.front{--nt-edge:var(--bv-lo)}
/* in a light theme the shadow half carries the edge against the desk (as in
   notched-bevel), so it is drawn darker than bevel's own shadow tone */
[data-border=notched-bevel-tab] .win:is([data-theme=day] *,[data-theme=mesa] *){--nt-edge:color-mix(in srgb,var(--fg) 72%,var(--bg));--nt-sh-c:var(--nt-edge)}
@media (pointer:coarse){[data-border=notched-bevel-tab] .win{--tab-h:max(44px,var(--title-h,24px))}}
/* shaded, the window is just its tab, closed along the bottom in shadow */
[data-border=notched-bevel-tab] .win[data-state=shaded]{--nt:12px;--nbt-bb:var(--nt-w)}
/* the body: clipped at the lower right only; ground starts under the tab */
[data-border=notched-bevel-tab] .frame{background:linear-gradient(transparent 0 var(--nbt-t),var(--bg) 0);
  clip-path:polygon(0 0,100% 0,100% calc(100% - var(--nt-br)),calc(100% - var(--nt-br)) 100%,0 100%)}
[data-border=notched-bevel-tab] .frame::after{clip-path:polygon(evenodd,
  0 var(--nbt-t),100% var(--nbt-t),100% calc(100% - var(--nt-br)),calc(100% - var(--nt-br)) 100%,0 100%,0 var(--nbt-t),
  var(--nt-w) calc(var(--nbt-t) + var(--nt-w)),calc(100% - var(--nt-w)) calc(var(--nbt-t) + var(--nt-w)),
  calc(100% - var(--nt-w)) calc(100% - var(--nt-a-br)),calc(100% - var(--nt-a-br)) calc(100% - var(--nt-w)),
  var(--nt-w) calc(100% - var(--nt-w)),var(--nt-w) calc(var(--nbt-t) + var(--nt-w)))}
/* the body's lit half: its top edge, full width (the tab rests on it), and its left edge */
[data-border=notched-bevel-tab] .frame::before{content:'';position:absolute;inset:0;z-index:4;pointer-events:none;background:var(--bv-hi);
  clip-path:polygon(0 100%,0 var(--nbt-t),100% var(--nbt-t),calc(100% - var(--nt-w)) calc(var(--nbt-t) + var(--nt-w)),
    var(--nt-w) calc(var(--nbt-t) + var(--nt-w)),var(--nt-w) calc(100% - var(--nt-w)))}
/* the tab */
[data-border=notched-bevel-tab] .title,[data-border=notched-bevel-tab] .front .title{
  --nt-tab:polygon(var(--nt-tl) 0,calc(100% - var(--nt-tr)) 0,100% var(--nt-tr),100% 100%,0 100%,0 var(--nt-tl));
  align-self:flex-start;max-width:100%;height:var(--tab-h);min-height:0;
  grid-template-columns:max-content minmax(0,auto) max-content;
  padding-right:calc(var(--nt-tr) + 5px);background:transparent;border-bottom:0;box-shadow:none}
[data-border=notched-bevel-tab] .title::before{content:'';position:absolute;inset:0;z-index:-1;background:var(--bv-face);clip-path:var(--nt-tab)}
[data-border=notched-bevel-tab] .front .title::before{background:var(--title)}
/* the tab's shadow ring: the whole outline, 2px, with a 1px shadow line along
   its base — the groove it sits in */
[data-border=notched-bevel-tab] .title::after{content:'';position:absolute;inset:0;z-index:2;pointer-events:none;background:var(--nt-edge);
  clip-path:polygon(evenodd,
    var(--nt-tl) 0,calc(100% - var(--nt-tr)) 0,100% var(--nt-tr),100% 100%,0 100%,0 var(--nt-tl),var(--nt-tl) 0,
    var(--nt-a-tl) var(--nt-w),calc(100% - var(--nt-a-tr)) var(--nt-w),calc(100% - var(--nt-w)) var(--nt-a-tr),
    calc(100% - var(--nt-w)) calc(100% - var(--nbt-bb)),var(--nt-w) calc(100% - var(--nbt-bb)),var(--nt-w) var(--nt-a-tl),var(--nt-a-tl) var(--nt-w))}
/* the tab's lit half, over it: up the left, across the cut, along the top to
   where the small upper-right cut begins */
[data-border=notched-bevel-tab] .title h2::after{content:'';position:absolute;inset:0;z-index:3;pointer-events:none;background:var(--bv-hi);
  clip-path:polygon(0 calc(100% - var(--nbt-bb)),0 var(--nt-tl),var(--nt-tl) 0,calc(100% - var(--nt-tr)) 0,
    calc(100% - var(--nt-a-tr)) var(--nt-w),var(--nt-a-tl) var(--nt-w),var(--nt-w) var(--nt-a-tl),var(--nt-w) calc(100% - var(--nbt-bb)))}
[data-border=notched-bevel-tab] .title h2{color:var(--bv-text-off)}
[data-border=notched-bevel-tab] .front .title h2{color:var(--title-fg)}
/* shaded there is no body, so no lower-right cut: the frame's clip would
   otherwise take the corner off a tab as wide as the window */
[data-border=notched-bevel-tab] .win[data-state=shaded] .frame{background:transparent;clip-path:none}
[data-border=notched-bevel-tab] .win[data-state=shaded] .frame::before,
[data-border=notched-bevel-tab] .win[data-state=shaded] .frame::after{display:none}
/* expanded, the strip beside the tab is desk, not a hole (see tab) */
[data-border=notched-bevel-tab] .win:is([data-state=expanded],[data-raised]) .frame{background:linear-gradient(var(--desk) 0 var(--nbt-t),var(--bg) 0)}
/* the menubar's current word is a small tab of the same kind: a cut block,
   lit from the upper left, in the title colour. taskbar buttons and menus
   are bevel's. */
[data-border=notched-bevel-tab] .surface:is([data-edge=top],.bar) .surface-btn:is([aria-current=true],[aria-pressed=true]){
  --cb-c:5px;--cb-fill:var(--title);--cb-hi:var(--bv-hi);--cb-lo:var(--bv-lo);color:var(--title-fg);border-color:transparent;
  background:
    linear-gradient(135deg,transparent 0 calc(var(--cb-c) * .7071),var(--cb-hi) 0 calc(var(--cb-c) * .7071 + 1px),transparent 0),
    linear-gradient(var(--cb-hi),var(--cb-hi)) var(--cb-c) 0/calc(100% - var(--cb-c)) 1px no-repeat,
    linear-gradient(var(--cb-hi),var(--cb-hi)) 0 var(--cb-c)/1px calc(100% - var(--cb-c)) no-repeat,
    linear-gradient(var(--cb-lo),var(--cb-lo)) 100% 0/1px 100% no-repeat,
    linear-gradient(var(--cb-lo),var(--cb-lo)) 0 100%/100% 1px no-repeat,
    linear-gradient(135deg,transparent 0 calc(var(--cb-c) * .7071),var(--cb-fill) 0)}

/* ================= notched-cut — the cut corner is the close =================
   notched, pushed: the upper-left cut is deep — the height of the title — and
   the corner it took is still there, sitting in the notch with a gap around
   it. that piece is the close. it wears the title's colour on the front
   window, so it reads as the bit of the bar that came away, and it casts its
   own gap. the hard shadow leans with a drag: the shell writes
   --lean-x/--lean-y from drag velocity, and the shadow trails behind the
   window's motion by that much, settling back when it settles.
   the shadow is a plate in the body's shape, not a drop-shadow: a filter
   would shadow the corner piece too, straight into its own notch, and fill
   the gap it depends on. the plate needs room inside the window's box (the
   shell clips a window to its box), so the frame gives up 16px at the lower
   right for it. */
[data-border=notched-cut] .win{--nt-tl:var(--title-h,24px);--nt-lx:var(--lean-x,0px);--nt-ly:var(--lean-y,0px);--nc:19px;
  --nc-pad:16px;padding:0 var(--nc-pad) var(--nc-pad) 0}
[data-border=notched-cut] .win.front{filter:none}
[data-border=notched-cut] .win.front::before{content:'';position:absolute;pointer-events:none;background:var(--nt-sh-c);
  --dx:clamp(0px,calc(var(--nt-sh) - var(--nt-lx)),var(--nc-pad));--dy:clamp(0px,calc(var(--nt-sh) - var(--nt-ly)),var(--nc-pad));
  top:var(--dy);left:var(--dx);right:calc(var(--nc-pad) - var(--dx));bottom:calc(var(--nc-pad) - var(--dy));
  clip-path:polygon(var(--nt-outer))}
[data-border=notched-cut] .win[data-state=shaded]{--nt:12px}
/* on touch the bar is 44px, so the cut and its piece grow with it: a bigger
   piece is the better target and holds the 9px mark */
@media (pointer:coarse){[data-border=notched-cut] .win{--nt-tl:36px;--nc:29px}}
/* the frame is clipped at the lower right only; the upper-left cut is drawn,
   so the corner piece inside it is not clipped away */
[data-border=notched-cut] .frame{isolation:isolate;background:transparent;
  clip-path:polygon(0 0,100% 0,100% calc(100% - var(--nt-br)),calc(100% - var(--nt-br)) 100%,0 100%)}
[data-border=notched-cut] .frame::before{content:'';position:absolute;inset:0;z-index:-1;background:var(--bg);clip-path:polygon(var(--nt-outer))}
[data-border=notched-cut] .title,[data-border=notched-cut] .front .title{background:transparent;padding-left:calc(var(--nt-tl) + 2px)}
[data-border=notched-cut] .title{--nc-shape:polygon(var(--nt-tl) 0,100% 0,100% 100%,0 100%,0 var(--nt-tl))}
/* the title's fill and its 2px line along the bottom are one clipped layer,
   so where the cut runs deeper than the bar (roomy controls) the line stops
   at the cut instead of crossing the notch */
[data-border=notched-cut] .title{border-bottom-color:transparent}
[data-border=notched-cut] .title::before{content:'';position:absolute;inset:0 0 calc(var(--nt-w) * -1) 0;z-index:-1;clip-path:var(--nc-shape);
  background:linear-gradient(to top,var(--nt-edge) 0 var(--nt-w),var(--nc-bar,transparent) 0)}
[data-border=notched-cut] .front .title::before{--nc-bar:var(--title)}
/* inactive, the piece is the frame's own edge colour — a bit of the frame
   that came away. a quieter fill vanished into the desk it sits on (1.0–1.7) */
[data-border=notched-cut] .c-close{position:absolute;left:0;top:0;width:var(--nc);height:var(--nc);
  --nc-fill:var(--nt-edge);--glyph-bg:var(--nc-fill);color:var(--bg);
  background:linear-gradient(135deg,var(--nc-fill) 0 calc(var(--nc) * .7071),transparent 0)}
[data-border=notched-cut] :is(.front .title,.sheet header) .c-close{--nc-fill:var(--title);color:var(--title-fg)}
/* the 7px × sits in the corner of the piece, 2px in, inside the largest
   square the triangle holds */
[data-border=notched-cut] .c-close .glyph{inset:2px auto auto 2px;margin:0;--gsz:7px;--gimg:var(--g7)}
@media (pointer:coarse){[data-border=notched-cut] .c-close .glyph{inset:3px auto auto 3px;--gsz:9px;--gimg:var(--g9)}}
[data-border=notched-cut] .c-close:is([data-pressing],:active){transform:none;translate:1px 1px}
@media (hover:hover){
  /* pointed at, the piece comes a pixel further out of its notch and inverts */
  [data-border=notched-cut] .c-close:hover{translate:-1px -1px;--nc-fill:var(--fg);color:var(--bg)}
  [data-border=notched-cut] :is(.front .title,.sheet header) .c-close:hover{--nc-fill:var(--title-fg);color:var(--title)}
}

/* ================= tab — the title is a tab on the frame =================
   beos put the title in a tab that sits on top of the window, only as wide as
   its name. the frame's top edge runs out from under it, so no two windows
   have the same outline. the tab is fixed to the left — haiku lets it slide,
   and a sliding tab is exactly the kind of thing that ends up gimmicky. */
[data-border=tab] .win{--tab-h:var(--title-h,24px);--tb-edge:var(--rule);background:transparent;border:0;padding:0;border-radius:0;box-shadow:none}
[data-border=tab] .win.front{--tb-edge:var(--dim)}
@media (pointer:coarse){[data-border=tab] .win{--tab-h:max(44px,var(--title-h,24px))}}
/* the ground starts at the frame's top line, not the tab's top: a hard
   two-stop fill, so the desk shows beside the tab */
[data-border=tab] .frame{position:relative;background:linear-gradient(transparent 0 calc(var(--tab-h) - 1px),var(--bg) 0)}
[data-border=tab] .frame::after{content:'';position:absolute;inset:calc(var(--tab-h) - 1px) 0 0;z-index:3;pointer-events:none;border:1px solid var(--tb-edge)}
[data-border=tab] .title{align-self:flex-start;max-width:100%;height:var(--tab-h);min-height:0;
  grid-template-columns:max-content minmax(0,auto) max-content;
  background:var(--ground);border:1px solid var(--tb-edge);border-bottom:0}
[data-border=tab] .front .title{background:var(--title)}
/* expanded, the strip beside the tab is the desk itself rather than a hole in
   the window: otherwise the tabs of the backing tier show through it, lined
   up along the same edge, and read as more tabs of this window */
[data-border=tab] .win:is([data-state=expanded],[data-raised]) .frame{background:linear-gradient(var(--desk) 0 calc(var(--tab-h) - 1px),var(--bg) 0)}
/* shaded, the window is just its tab, closed along the bottom */
[data-border=tab] .win[data-state=shaded] .frame{background:transparent}
[data-border=tab] .win[data-state=shaded] .frame::after{display:none}
[data-border=tab] .win[data-state=shaded] .title{border-bottom:1px solid var(--tb-edge)}
[data-border=tab] .c-btn{background:transparent;--glyph-bg:var(--ground)}
[data-border=tab] .c-close .glyph{inset:2px;width:auto;height:auto}
[data-border=tab] .c-close .glyph::before{display:none}
[data-border=tab] :is(.front .title,.sheet header) .c-btn{border-color:var(--title-fg);color:var(--title-fg);--glyph-bg:var(--title)}
@media (hover:hover){
  [data-border=tab] .c-btn:hover{border-color:var(--fg);color:var(--fg)}
  [data-border=tab] .c-close:hover .glyph{background:currentColor}
  [data-border=tab] :is(.front .title,.sheet header) .c-btn:hover{background:var(--title-fg);color:var(--title);--glyph-bg:var(--title-fg)}
  [data-border=tab] :is(.front .title,.sheet header) .c-close:hover .glyph{background:var(--title)}
}
/* surfaces: a pinned bar is a line; what it holds hangs off that line as a
   tab — down from a taskbar's top edge, up from a menubar's bottom edge,
   the way sheet tabs hang at the foot of a spreadsheet */
[data-border=tab] .surface{border:1px solid var(--rule)}
[data-border=tab] .surface:is([data-edge=top],.bar){border-width:0 0 1px}
[data-border=tab] .surface:is([data-edge=bottom],.taskbar){border-width:1px 0 0}
[data-border=tab] .surface-btn{border-radius:0}
[data-border=tab] .surface-btn:is([aria-pressed=true],[aria-current=true]){background:var(--title);color:var(--title-fg);border-color:var(--dim)}
[data-border=tab] .surface:is([data-edge=bottom],.taskbar) .surface-btn:is([aria-pressed=true],[aria-current=true]){border-top-color:transparent}
[data-border=tab] .surface:is([data-edge=top],.bar) .surface-btn:is([aria-pressed=true],[aria-current=true]){border-bottom-color:transparent}
@media (hover:hover){[data-border=tab] .surface-btn:not([aria-pressed=true]):not([aria-current=true]):hover{border-color:var(--rule)}}

/* ================= corners — crop marks, no border =================
   the window is a plate of its own ground, and the frame exists only where a
   printer would mark the trim. the front window's marks turn its title colour
   and thicken; the others stay dim and thin.
   hook for the x motif: every corner is the same upper-left mark, mirrored.
   set --corner-mark to an image (and --cm-w to 0) and all four corners carry
   it, flipped into place. */
[data-border=corners] .win{--cm:11px;--cm-w:1px;--cm-c:var(--dim);--cm-ring:6px;
  background:var(--bg);border:0;padding:var(--cm-ring);border-radius:0;box-shadow:none}
[data-border=corners] .win.front{--cm-w:2px;--cm-c:var(--title)}
[data-border=corners] .frame{position:relative}
[data-border=corners] :is(.win,.frame)::before,
[data-border=corners] :is(.win,.frame)::after{content:'';position:absolute;z-index:3;pointer-events:none;
  width:var(--cm);height:var(--cm);border:0 solid var(--cm-c);border-top-width:var(--cm-w);border-left-width:var(--cm-w);
  background:var(--corner-mark,none) center/contain no-repeat}
[data-border=corners] .win::before{top:0;left:0}
[data-border=corners] .win::after{top:0;right:0;transform:scaleX(-1)}
[data-border=corners] .frame::before{bottom:calc(var(--cm-ring) * -1);left:calc(var(--cm-ring) * -1);transform:scaleY(-1)}
[data-border=corners] .frame::after{bottom:calc(var(--cm-ring) * -1);right:calc(var(--cm-ring) * -1);transform:scale(-1)}
[data-border=corners] .title{border-bottom:1px solid var(--rule)}
[data-border=corners] .front .title{border-bottom-color:transparent}
[data-border=corners] .win[data-state=shaded] .title{border-bottom-color:transparent}
/* the controls are marks with no box of their own, like everything else here */
[data-border=corners] .c-btn{border-color:transparent;background:transparent;--glyph-bg:var(--bg);color:var(--dim)}
[data-border=corners] :is(.front .title,.sheet header) .c-btn{color:var(--title-fg);--glyph-bg:var(--title)}
@media (hover:hover){
  [data-border=corners] .c-btn:hover{background:var(--ground);color:var(--fg);--glyph-bg:var(--ground)}
  [data-border=corners] :is(.front .title,.sheet header) .c-btn:hover{background:var(--title-fg);color:var(--title);--glyph-bg:var(--title-fg)}
}
/* a floating surface gets the four marks as background strokes rather than
   pseudo-elements, so the shell's own ::before/::after stay free; a pinned bar
   is a single rule. a pressed button is registered, not filled: marks at its
   corners in the title colour. */
[data-border=corners] :is(.surface,.surface-btn){
  --cmk:var(--dim);--cml:9px;--cmw:1px;
  --cm-strokes:
    linear-gradient(var(--cmk),var(--cmk)) left top/var(--cml) var(--cmw) no-repeat,
    linear-gradient(var(--cmk),var(--cmk)) left top/var(--cmw) var(--cml) no-repeat,
    linear-gradient(var(--cmk),var(--cmk)) right top/var(--cml) var(--cmw) no-repeat,
    linear-gradient(var(--cmk),var(--cmk)) right top/var(--cmw) var(--cml) no-repeat,
    linear-gradient(var(--cmk),var(--cmk)) left bottom/var(--cml) var(--cmw) no-repeat,
    linear-gradient(var(--cmk),var(--cmk)) left bottom/var(--cmw) var(--cml) no-repeat,
    linear-gradient(var(--cmk),var(--cmk)) right bottom/var(--cml) var(--cmw) no-repeat,
    linear-gradient(var(--cmk),var(--cmk)) right bottom/var(--cmw) var(--cml) no-repeat}
[data-border=corners] .surface{background:var(--cm-strokes);background-color:var(--bg)}
[data-border=corners] .surface:is([data-edge],.bar,.taskbar){background-image:none}
[data-border=corners] .surface:is([data-edge=top],.bar){border-bottom:1px solid var(--rule)}
[data-border=corners] .surface:is([data-edge=bottom],.taskbar){border-top:1px solid var(--rule)}
[data-border=corners] .surface-btn{--cml:5px}
[data-border=corners] .surface-btn:is([aria-pressed=true],[aria-current=true]){--cmk:var(--title);--cmw:2px;background:var(--cm-strokes)}
@media (hover:hover){[data-border=corners] .surface-btn:not([aria-pressed=true]):not([aria-current=true]):hover{background:var(--cm-strokes)}}

/* ================= dither — a 1-bit edge, from no os =================
   the edge is the same 4x4 bayer matrix the portrait and the dock's hover
   already use. a 1px line holds the frame, and outside it the edge falls
   away in three 2px bands of ordered dither — dense, sparser, sparsest — so
   the window stands on the desk in stepped 1-bit, the way the dither widget
   renders a gradient. the bands are a token-coloured layer masked by the
   bayer tiles (colourless alpha masks), so every theme draws them in its own
   ink: the title colour on the front window, dim on the rest, and one band
   fewer. all the tiles are phased to the window's corner, so the three bands
   read as one falloff rather than three patterns. */
[data-border=dither] .win{--dt-c:var(--dim);--dt-1:var(--bayer-6);--dt-2:var(--bayer-3);--dt-3:linear-gradient(transparent 0 0);--dt-edge:var(--dim);
  background:transparent;border:0;padding:6px;border-radius:0;box-shadow:none}
[data-border=dither] .win.front{--dt-c:var(--title);--dt-1:var(--bayer-12);--dt-2:var(--bayer-6);--dt-3:var(--bayer-3);--dt-edge:var(--fg)}
[data-border=dither] .frame{position:relative;background:var(--bg);border:1px solid var(--dt-edge)}
[data-border=dither] .frame::before,[data-border=dither] .win::before,[data-border=dither] .win::after{content:'';position:absolute;pointer-events:none;border:2px solid transparent;
  background:var(--dt-c) border-box;
  -webkit-mask:var(--dt-m) 0 0/4px 4px border-box,linear-gradient(#000 0 0) padding-box;-webkit-mask-composite:source-out;
          mask:var(--dt-m) 0 0/4px 4px border-box,linear-gradient(#000 0 0) padding-box;mask-composite:subtract}
[data-border=dither] .frame::before{inset:-3px;--dt-m:var(--dt-1)}
[data-border=dither] .win::before{inset:2px;--dt-m:var(--dt-2);-webkit-mask-position:-2px -2px,0 0;mask-position:-2px -2px,0 0}
[data-border=dither] .win::after{inset:0;--dt-m:var(--dt-3)}
[data-border=dither] .title{border-bottom:1px solid var(--rule)}
[data-border=dither] .front .title{border-bottom-color:var(--dt-edge)}
[data-border=dither] .win[data-state=shaded] .title{border-bottom-color:transparent}
/* the controls are outlined in dither: a 2px ring of the same tile around a
   clear middle, so the mark stays legible. pointed at, the ring goes solid
   — the threshold passed — and pressed, the block fills. */
[data-border=dither] .c-btn{border:0;background:transparent;color:var(--dim);--glyph-bg:var(--bg);--dt-b:var(--bayer-9)}
[data-border=dither] :is(.front .title,.sheet header) .c-btn{color:var(--title-fg);--glyph-bg:var(--title)}
[data-border=dither] .c-btn::after{content:'';position:absolute;inset:0;pointer-events:none;border:2px solid transparent;background:currentColor border-box;
  -webkit-mask:var(--dt-b) 0 0/4px 4px border-box,linear-gradient(#000 0 0) padding-box;-webkit-mask-composite:source-out;
          mask:var(--dt-b) 0 0/4px 4px border-box,linear-gradient(#000 0 0) padding-box;mask-composite:subtract}
[data-border=dither] .c-close{width:15px;height:15px}
[data-border=dither] .c-btn:is([data-pressing],:active){transform:none;background:var(--fg);color:var(--bg);--glyph-bg:var(--fg)}
[data-border=dither] :is(.front .title,.sheet header) .c-btn:is([data-pressing],:active){background:var(--title-fg);color:var(--title);--glyph-bg:var(--title-fg)}
@media (hover:hover){[data-border=dither] .c-btn:hover{--dt-b:var(--bayer-16);color:var(--fg)}
  [data-border=dither] :is(.front .title,.sheet header) .c-btn:hover{color:var(--title-fg)}}
/* surfaces: a pinned bar is a line with a band of dither on the desk side;
   a floating one is ringed in it, like a window. a pressed button is filled
   with the title colour, since text on dither would not read. */
[data-border=dither] .surface{border:1px solid var(--dim)}
[data-border=dither] .surface:is([data-edge],.bar,.taskbar){border-width:0}
[data-border=dither] .surface:is([data-edge=top],.bar){border-bottom:1px solid var(--dim)}
[data-border=dither] .surface:is([data-edge=bottom],.taskbar){border-top:1px solid var(--dim)}
[data-border=dither] .surface::after{content:'';position:absolute;pointer-events:none;background:var(--dim);
  -webkit-mask:var(--bayer-6) 0 0/4px 4px;mask:var(--bayer-6) 0 0/4px 4px}
[data-border=dither] .surface:is([data-edge=top],.bar)::after{left:0;right:0;top:100%;height:4px}
[data-border=dither] .surface:is([data-edge=bottom],.taskbar)::after{left:0;right:0;bottom:100%;height:4px}
[data-border=dither] .surface:not([data-edge],.bar,.taskbar){position:relative}
[data-border=dither] .surface:not([data-edge],.bar,.taskbar)::after{inset:-5px;border:4px solid transparent;background:var(--dim) border-box;
  -webkit-mask:var(--bayer-6) 0 0/4px 4px border-box,linear-gradient(#000 0 0) padding-box;-webkit-mask-composite:source-out;
          mask:var(--bayer-6) 0 0/4px 4px border-box,linear-gradient(#000 0 0) padding-box;mask-composite:subtract}
[data-border=dither] .surface-btn:is([aria-pressed=true],[aria-current=true]){background:var(--title);color:var(--title-fg);border-color:var(--title)}
@media (hover:hover){[data-border=dither] .surface-btn:not([aria-pressed=true]):not([aria-current=true]):hover{border-color:var(--dim)}}

/* ================= interactions: lift =================
   :root[data-lift=on] — the shell sets [data-lifted] on a window from the
   press on its title until release. the window rises off the desk a pixel
   toward the light and its shadow lengthens; each border says it in its own
   terms, and a border with no shadow gets the nearest honest thing. instant:
   it answers the press, it doesn't perform. `translate` rather than
   `transform`, because the shell's drag already owns the window's transform. */
[data-lift=on] .win[data-lifted]{translate:-1px -1px}
[data-lift=on][data-border=hairline] .win[data-lifted]{box-shadow:0 26px 46px -26px color-mix(in srgb,#000 90%,transparent)}
/* bevel: no shadow in windows 95, so the lifted frame casts a hard one in its own shadow tone */
[data-lift=on][data-border=bevel] .win[data-lifted]{box-shadow:3px 3px 0 var(--bv-lo)}
[data-lift=on][data-border^=notched] .win[data-lifted]{--nt-sh:10px}
[data-lift=on]:is([data-border=notched-bevel],[data-border=notched-bevel-tab],[data-border=notched-bevel-bar]) .win[data-lifted]{--nt-sh:7px}
/* tab: a window of lines and a tab gets a hard shadow the shape of both */
[data-lift=on][data-border=tab] .win[data-lifted]{filter:drop-shadow(4px 4px 0 color-mix(in srgb,var(--fg) 24%,var(--desk)))}
/* corners: the marks open out, as a plate lifted off its trim */
[data-lift=on][data-border=corners] .win[data-lifted]{--cm:16px}
/* dither: every band steps one level denser */
[data-lift=on][data-border=dither] .win[data-lifted]{--dt-1:var(--bayer-16);--dt-2:var(--bayer-9);--dt-3:var(--bayer-6)}

/* ================= interactions: threshold focus =================
   :root[data-focusfx=threshold] — when a window takes focus, its title fill
   arrives through the 4x4 ordered dither in 120ms: a veil in the inactive
   title's colour covers the bar and loses its cells in bayer order, the same
   six levels as desktop 2's dock (MASKS: 16, 12, 9, 6, 3, 0). the veil is the
   title's h2::before — positioned against the bar, under the text and the
   controls — so no border's own pseudo-elements are taken. it plays only
   when the focus came from a pointer ([data-input=pointer]; the root has no
   input mode until the first real input, so a page load doesn't set it off),
   never for keyboard focus, and never under reduced motion. */
.title{isolation:isolate}
:where(.win){--veil:var(--bg)}
[data-border=bevel] .win{--veil:var(--bv-face)}
[data-border=tab] .win{--veil:var(--ground)}
[data-focusfx=threshold][data-input=pointer] .front .title h2::before{content:'';position:absolute;inset:0;z-index:-1;pointer-events:none;
  background:var(--veil);opacity:0;animation:fx-threshold 120ms step-end}
[data-focusfx=threshold][data-border=bevel] .front .title h2::before{inset:0 0 3px}
[data-focusfx=threshold]:is([data-border=notched-tab],[data-border=notched-bevel-tab]) .front .title h2::before{clip-path:var(--nt-tab)}
[data-focusfx=threshold][data-border=notched-bevel-tab] .front .title h2::before{inset:0 0 1px}
[data-focusfx=threshold][data-border=notched-bevel-bar] .front .title h2::before{inset:0 0 1px;clip-path:var(--nbb-shape)}
[data-focusfx=threshold][data-border=notched-cut] .front .title h2::before{clip-path:var(--nc-shape)}
@keyframes fx-threshold{
  0%{opacity:1;-webkit-mask-image:var(--bayer-16);mask-image:var(--bayer-16)}
  20%{opacity:1;-webkit-mask-image:var(--bayer-12);mask-image:var(--bayer-12)}
  40%{opacity:1;-webkit-mask-image:var(--bayer-9);mask-image:var(--bayer-9)}
  60%{opacity:1;-webkit-mask-image:var(--bayer-6);mask-image:var(--bayer-6)}
  80%{opacity:1;-webkit-mask-image:var(--bayer-3);mask-image:var(--bayer-3)}
  100%{opacity:0}}
[data-focusfx=threshold] .front .title h2::before{-webkit-mask-size:4px 4px;mask-size:4px 4px}
@media (prefers-reduced-motion:reduce){.front .title h2::before{animation:none!important}}

/* ================= control size: a preference =================
   :root[data-ctl=roomy|compact], set by the shell from appearance. axel
   "loves the window controls, especially roomy", so roomy is the default
   there. roomy is the kit's 9px glyphs in the housings sized for them (a
   15px box, or bevel's 17×15, notched's 15 and the 21×15 wedge); compact
   is its 7px glyphs in the housings one step down (13, bevel's 15×13, the
   17×13 wedge). with no data-ctl the per-border and per-density choice
   above stands. every size keeps the glyph centred on whole pixels. */
:root[data-ctl=roomy] .c-btn .glyph{--gsz:9px;--gimg:var(--g9)}
:root[data-ctl=compact] .c-btn .glyph{--gsz:7px;--gimg:var(--g7)}
:is([data-ctl=roomy] [data-border=hairline],[data-ctl=roomy][data-border=hairline],[data-ctl=roomy] [data-border=tab],[data-ctl=roomy][data-border=tab],[data-ctl=roomy] [data-border=corners],[data-ctl=roomy][data-border=corners]) .c-close{width:15px;height:15px}
/* dither's ring is 2px, so the 9px mark needs a 17px ring to keep 2px clear */
:is([data-ctl=roomy] [data-border=dither],[data-ctl=roomy][data-border=dither]) .c-btn{width:17px;height:17px}
/* notched-cut: the piece has to hold the 9px mark with its corner clear of
   the hypotenuse, so the cut runs 5px deeper than the bar and the body gives
   up that sliver of its upper-left corner (pointer only; touch already has
   its larger cut) */
@media (hover:hover) and (pointer:fine){
  :is([data-ctl=roomy] [data-border=notched-cut],[data-ctl=roomy][data-border=notched-cut]) .win{--nt-tl:29px;--nc:24px}
  :is([data-ctl=roomy] [data-border=notched-cut],[data-ctl=roomy][data-border=notched-cut]) .frame>.title+*{clip-path:polygon(5px 0,100% 0,100% 100%,0 100%,0 5px)}
  :is([data-ctl=roomy] [data-border=notched-cut],[data-ctl=roomy][data-border=notched-cut]) .c-close .glyph{inset:2px auto auto 2px}
}
:is([data-ctl=compact] [data-border=hairline],[data-ctl=compact][data-border=hairline],[data-ctl=compact] [data-border=tab],[data-ctl=compact][data-border=tab],[data-ctl=compact] [data-border=corners],[data-ctl=compact][data-border=corners],[data-ctl=compact] [data-border=dither],[data-ctl=compact][data-border=dither]) .c-btn{width:13px;height:13px}
:is([data-ctl=compact] [data-border=bevel],[data-ctl=compact][data-border=bevel]) .c-btn{width:15px;height:13px}
:is([data-ctl=compact] [data-border=notched],[data-ctl=compact][data-border=notched],[data-ctl=compact] [data-border=notched-tab],[data-ctl=compact][data-border=notched-tab],[data-ctl=compact] [data-border=notched-bevel],[data-ctl=compact][data-border=notched-bevel],[data-ctl=compact] [data-border=notched-bevel-tab],[data-ctl=compact][data-border=notched-bevel-tab],[data-ctl=compact] [data-border=notched-cut],[data-ctl=compact][data-border=notched-cut]) .c-btn{width:13px;height:13px}
:is([data-ctl=compact] [data-border=notched],[data-ctl=compact][data-border=notched],[data-ctl=compact] [data-border=notched-tab],[data-ctl=compact][data-border=notched-tab],[data-ctl=compact] [data-border=notched-bevel],[data-ctl=compact][data-border=notched-bevel],[data-ctl=compact] [data-border=notched-bevel-tab],[data-ctl=compact][data-border=notched-bevel-tab]) .c-close{width:17px;height:13px;--cb-c:7px}
:is([data-ctl=compact] [data-border=notched-bevel-bar],[data-ctl=compact][data-border=notched-bevel-bar]) .c-btn{width:13px;height:13px}
:is([data-ctl=compact] [data-border=notched-bevel-bar],[data-ctl=compact][data-border=notched-bevel-bar]) .win{--nbb-hh:13px}
:is([data-ctl=compact] [data-border=notched-bevel-bar],[data-ctl=compact][data-border=notched-bevel-bar]) .c-close{--hw:17px;width:var(--hw);height:var(--hh)}
/* notched-cut's close is its corner piece at any size */
:is([data-ctl=compact] [data-border=notched-cut],[data-ctl=compact][data-border=notched-cut]) .c-close,:is([data-ctl=roomy] [data-border=notched-cut],[data-ctl=roomy][data-border=notched-cut]) .c-close{width:var(--nc);height:var(--nc)}

/* ================= elevation: expanded, guests, the raised tier =================
   expanded fills the desk, so it is the raised tier by another name. a
   rectangular box-shadow reads wrong on a cut, tabbed or unbordered window,
   so each border states its own, and the shell's guest and raised shadows are
   cleared here for every border but the control. */
[data-border=hairline] .win:is([data-state=expanded],[data-raised]){box-shadow:0 0 0 1px var(--rule),12px 14px 0 color-mix(in srgb,var(--fg) 10%,transparent)}
[data-border]:not([data-border=hairline]) .desk>.win:is([data-guest],[data-raised],[data-state=expanded]){box-shadow:none}
[data-border^=notched] .win.front:is([data-state=expanded],[data-raised],[data-guest]){--nt-sh:9px}
[data-border=bevel] .win:is([data-state=expanded],[data-raised]){outline:1px solid var(--bv-lo)}

/* ================= the backing tier =================
   behind a raised or expanded window the rest keep their frame and lose their
   material: flat ground, rule-weight edges, no shadow, contents gone grey. a
   step, not a fade — and inert (the shell's job), so none of it owes contrast. */
.desk[data-focus]>.win:not([data-raised]):not([data-state=expanded]){box-shadow:none;filter:none}
.desk[data-focus]>.win:not([data-raised]):not([data-state=expanded]) .frame{filter:grayscale(1);opacity:.4}
.desk[data-focus]>.win:not([data-raised]):not([data-state=expanded]) .title{background-color:transparent}
.desk[data-focus]>.win:not([data-raised]):not([data-state=expanded]) .title h2{color:var(--dim)}
.desk[data-focus]>.win:not([data-raised]):not([data-state=expanded]) .c-btn{border-color:var(--rule);color:var(--dim);background:transparent}
[data-border=hairline] .desk[data-focus]>.win:not([data-raised]):not([data-state=expanded]){background:var(--ground);border-color:var(--rule)}
[data-border=bevel] .desk[data-focus]>.win:not([data-raised]):not([data-state=expanded]){background:var(--ground);border-color:var(--rule)}
[data-border=corners] .desk[data-focus]>.win:not([data-raised]):not([data-state=expanded]){--cm-c:var(--rule);--cm-w:1px;background:var(--ground)}
[data-border=tab] .desk[data-focus]>.win:not([data-raised]):not([data-state=expanded]){--tb-edge:var(--rule)}

/* ================= more contrast =================
   every edge that was a tint becomes ink, and nothing casts. */
@media (prefers-contrast:more){
  .win,.surface{box-shadow:none!important;filter:none!important}
  [data-border*=bevel] :is(.win,.surface,.surface-btn){--bv-hi:color-mix(in srgb,var(--fg) 75%,var(--bv-face))}
  [data-border*=bevel] :is(.win,.surface,.surface-btn):is([data-theme=day] *,[data-theme=mesa] *){--bv-lo:var(--fg)}
  [data-border^=notched][data-border*=bevel] .win:is([data-theme=day] *,[data-theme=mesa] *){--nt-edge:var(--fg)}
  [data-border^=notched]:not([data-border*=bevel]) .win{--nt-edge:var(--fg)}
  [data-border=tab] .win{--tb-edge:var(--dim)}
  [data-border=corners] .win{--cm-w:2px}
  [data-border=notched-cut] .win.front::before{display:none}
  [data-border=corners] .win:not(.front){--cm-c:var(--fg)}
}
