/* CamOS drawer: shadcn Drawer (shadcn.io/ui/drawer, Base UI) with the iOS sheet look. The one look for every panel you
   swipe away: the dashboard's components/ui/drawer.tsx renders these classes (imported into the bundle by index.css),
   plain-JS pages build the same markup through public/cui-drawer.js. Change it here only.
   Markup:  <div class="cui-drawer-backdrop"></div>                 dim (fades with the drag)
            <div class="cui-drawer-viewport" data-modal="true">
              <div class="cui-drawer" data-swipe-direction="down" data-swipe-axis="y" [data-snap-points]>
                <div class="cui-drawer-grabber"></div>              Apple's grabber on the swipe edge (optional)
                <div class="cui-drawer-content">                     the part that scrolls
                  <div class="cui-drawer-header"><h2 class="cui-drawer-title"></h2><p class="cui-drawer-description"></p></div>
                  …
                  <div class="cui-drawer-footer"></div>
                </div>
              </div>
            </div>
   Drag state comes from Base UI (React) or cui-drawer.js as the same CSS variables and attributes:
   --drawer-swipe-movement-x/y, --drawer-snap-point-offset, --drawer-swipe-progress, --drawer-swipe-strength,
   --nested-drawers, --drawer-height, --drawer-frontmost-height; [data-swiping], [data-starting-style],
   [data-ending-style], [data-nested-drawer-open], [data-nested-drawer-swiping], [data-expanded].
   Look: the kit's elevated surface with the sheet shadow, 36px corners on the open edge (the phone screen's curve), a 36x5
   grabber 5px from the edge, a spring settle. Bottom sheets on phones push the page behind back (the iOS card stack,
   [data-cui-indent] below). Reduced motion: fades, no slide, no scale. The dashboard imports this file into the cui-parts layer: above the kit's parts, below Tailwind classes. */
@layer theme,camos;
@layer camos{
.cui-drawer,.cui-drawer-backdrop,.cui-drawer-viewport{
  --cui-drawer-spring-ms:520ms;
  /* The large detent's top gap: the status bar plus 10px, at least 8% of the screen (SwiftUI .large is ~92%). */
  --cui-drawer-top:max(calc(env(safe-area-inset-top,0px) + 10px),8dvh);
}

/* Backdrop: the overlay colour, fading out as the sheet is dragged away. */
.cui-drawer-backdrop{position:fixed;inset:0;z-index:9995;min-height:100dvh;background:var(--dialog-backdrop-dim-background);
  opacity:max(var(--cui-drawer-backdrop-min,0),calc(1 - var(--drawer-swipe-progress,0)));
  transition:opacity 450ms var(--cubic-enter);-webkit-user-select:none;user-select:none}
.cui-drawer-backdrop[data-snap-points]{--cui-drawer-backdrop-min:.5}
.cui-drawer-backdrop:is([data-starting-style],[data-ending-style]){opacity:0}
.cui-drawer-backdrop[data-ending-style]{pointer-events:none;transition-duration:calc(var(--drawer-swipe-strength,1) * 400ms)}
.cui-drawer-backdrop[data-swiping]{transition-duration:0ms}

/* Viewport: the fixed layer. A non-modal drawer lets taps through to the page. */
.cui-drawer-viewport{position:fixed;inset:0;z-index:9996;pointer-events:none;-webkit-user-select:none;user-select:none}
.cui-drawer-viewport[data-modal=true]{pointer-events:auto}

.cui-drawer{
  --bleed:3rem;--peek:1rem;--stack-step:.05;
  --stack-height:var(--drawer-frontmost-height,var(--drawer-height,0px));
  --stack-progress:clamp(0,var(--drawer-swipe-progress,0),1);
  --stack-peek-offset:max(0px,calc((var(--nested-drawers,0) - var(--stack-progress)) * var(--peek)));
  --stack-scale-base:max(0,calc(1 - (var(--nested-drawers,0) * var(--stack-step))));
  --stack-scale:clamp(0,calc(var(--stack-scale-base) + (var(--stack-step) * var(--stack-progress))),1);
  --stack-shrink:calc(1 - var(--stack-scale));
  position:fixed;z-index:9996;box-sizing:border-box;display:flex;flex-direction:column;min-height:0;margin:0;
  outline:none;pointer-events:auto;color:var(--color-text);font-size:var(--font-text-sm-size);line-height:var(--font-text-sm-line-height);text-align:start;
  background:var(--color-surface-elevated);
  box-shadow:var(--shadow-400),var(--shadow-hairline);
  transform:translate3d(var(--translate-x,0px),var(--translate-y,0px),0) scale(var(--stack-scale));
  transition:transform var(--cui-drawer-spring-ms) var(--cubic-enter),height 450ms var(--cubic-enter),opacity 450ms var(--cubic-enter),filter 450ms var(--cubic-enter);
  will-change:transform;interpolate-size:allow-keywords;-webkit-user-select:none;user-select:none}
/* The bleed: the same surface past the screen edge, so a drag past the top never shows a gap (rubber band). */
.cui-drawer::after{content:"";position:absolute;pointer-events:none;background:var(--color-surface-elevated)}
.cui-drawer[data-swipe-axis=y]::after{inset-inline:0;height:var(--bleed)}
.cui-drawer[data-swipe-axis=x]::after{inset-block:0;width:var(--bleed)}
.cui-drawer[data-swipe-direction=down]::after{top:100%}
.cui-drawer[data-swipe-direction=up]::after{bottom:100%}
.cui-drawer[data-swipe-direction=left]::after{right:100%}
.cui-drawer[data-swipe-direction=right]::after{left:100%}

/* Bottom sheet: up from the bottom edge; with snap points it is the large detent's height and slides down to a stop. */
.cui-drawer[data-swipe-direction=down]{inset-inline:0;bottom:0;transform-origin:bottom center;
  height:var(--drawer-height,auto);max-height:calc(100dvh - var(--cui-drawer-top));border-radius:var(--radius-4xl) var(--radius-4xl) 0 0;
  --closed-transform:translate3d(0,calc(100% + 2px),0);
  --translate-y:calc(var(--drawer-snap-point-offset,0px) + var(--drawer-swipe-movement-y,0px) - var(--stack-peek-offset) - (var(--stack-shrink) * var(--stack-height)))}
.cui-drawer[data-swipe-direction=down][data-snap-points]{height:calc(100dvh - var(--cui-drawer-top));
  padding-bottom:max(0px,calc(var(--drawer-snap-point-offset,0px) + var(--drawer-swipe-movement-y,0px)))}
.cui-drawer[data-swipe-direction=up]{inset-inline:0;top:0;transform-origin:top center;
  height:var(--drawer-height,auto);max-height:calc(100dvh - var(--cui-drawer-top));border-radius:0 0 var(--radius-4xl) var(--radius-4xl);
  padding-top:env(safe-area-inset-top,0px);
  --closed-transform:translate3d(0,calc(-100% - 2px),0);
  --translate-y:calc(var(--drawer-snap-point-offset,0px) + var(--drawer-swipe-movement-y,0px) + var(--stack-peek-offset) + (var(--stack-shrink) * var(--stack-height)))}
/* Side drawers: a tray beside the page, rounded on the side that faces it. */
.cui-drawer[data-swipe-axis=x]{inset-block:0;width:min(24rem,85vw)}
.cui-drawer[data-swipe-direction=left]{left:0;transform-origin:left center;border-radius:0 var(--radius-4xl) var(--radius-4xl) 0;
  --closed-transform:translate3d(calc(-100% - 2px),0,0);
  --translate-x:calc(var(--drawer-swipe-movement-x,0px) + var(--stack-peek-offset) + (var(--stack-shrink) * 100%))}
.cui-drawer[data-swipe-direction=right]{right:0;transform-origin:right center;border-radius:var(--radius-4xl) 0 0 var(--radius-4xl);
  --closed-transform:translate3d(calc(100% + 2px),0,0);
  --translate-x:calc(var(--drawer-swipe-movement-x,0px) - var(--stack-peek-offset) - (var(--stack-shrink) * 100%))}
/* Wide screens: a bottom sheet is a centred card, not a full-width band. */
@media (min-width:768px){
  .cui-drawer[data-swipe-direction=down],.cui-drawer[data-swipe-direction=up]{inset-inline:max(16px,calc(50% - 320px))}
}

/* Open and close: slide from the edge; the release after a flick is as fast as the flick (Base UI's swipe strength). */
.cui-drawer:is([data-starting-style],[data-ending-style]){transform:var(--closed-transform)}
.cui-drawer[data-ending-style]{opacity:.9999;transition-duration:calc(var(--drawer-swipe-strength,1) * 400ms);transition-timing-function:var(--cubic-enter)}
.cui-drawer:is([data-swiping],[data-nested-drawer-swiping]){transition-duration:0ms}
.cui-drawer[data-ending-style]:is([data-swiping],[data-nested-drawer-swiping]){transition-duration:calc(var(--drawer-swipe-strength,1) * 400ms)}

/* Nested: the sheet behind steps back (lower, smaller, a little darker) and hides its content; closing the front one
   brings it back (one step). */
.cui-drawer[data-nested-drawer-open]{overflow:hidden;filter:brightness(.92)}
.cui-drawer[data-swipe-axis=y][data-nested-drawer-open]{height:var(--stack-height)}
.cui-drawer[data-nested-drawer-open]>:is(.cui-drawer-content,.cui-drawer-grabber){opacity:0}
.cui-drawer[data-nested-drawer-open][data-nested-drawer-swiping]>:is(.cui-drawer-content,.cui-drawer-grabber){opacity:1}

/* Apple's grabber: 36x5, 5px from the swipe edge, with a finger-sized hit area. */
.cui-drawer-grabber{position:absolute;z-index:3;border-radius:var(--radius-full);background:var(--color-border-strong);cursor:grab;touch-action:none;transition:opacity .2s}
.cui-drawer-grabber::before{content:"";position:absolute;inset:-12px -40px}
.cui-drawer-grabber:active{cursor:grabbing}
.cui-drawer[data-swipe-axis=y]>.cui-drawer-grabber{left:50%;width:36px;height:5px;margin-left:-18px}
.cui-drawer[data-swipe-direction=down]>.cui-drawer-grabber{top:5px}
.cui-drawer[data-swipe-direction=up]>.cui-drawer-grabber{bottom:5px}
.cui-drawer[data-swipe-axis=x]>.cui-drawer-grabber{top:50%;width:5px;height:36px;margin-top:-18px}
.cui-drawer[data-swipe-axis=x]>.cui-drawer-grabber::before{inset:-40px -12px}
.cui-drawer[data-swipe-direction=right]>.cui-drawer-grabber{left:5px}
.cui-drawer[data-swipe-direction=left]>.cui-drawer-grabber{right:5px}

/* Content: the part that scrolls; text can be selected with a mouse. */
.cui-drawer-content{position:relative;display:flex;flex:1 1 auto;flex-direction:column;min-height:0;
  overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;border-radius:inherit;scrollbar-width:thin;
  transition:opacity .3s var(--cubic-enter);-webkit-user-select:text;user-select:text}
.cui-drawer[data-swiping] .cui-drawer-content{-webkit-user-select:none;user-select:none}
.cui-drawer[data-swipe-direction=down] .cui-drawer-content{padding-bottom:env(safe-area-inset-bottom,0px)}
.cui-drawer[data-swipe-axis=x] .cui-drawer-content{padding-block:env(safe-area-inset-top,0px) env(safe-area-inset-bottom,0px)}

.cui-drawer-header{display:flex;flex:none;flex-direction:column;gap:4px;min-width:0;padding:20px 20px 8px}
.cui-drawer[data-swipe-axis=y] .cui-drawer-header{text-align:center}
.cui-drawer-title{margin:0;color:var(--color-text);font-size:var(--font-heading-md-size);font-weight:var(--font-weight-semibold);line-height:var(--font-heading-md-line-height);overflow-wrap:anywhere}
.cui-drawer-description{margin:0;color:var(--color-text-secondary);font-size:var(--font-text-sm-size);line-height:var(--font-text-sm-line-height);text-wrap:balance}
.cui-drawer-footer{display:flex;flex:none;flex-direction:column;gap:8px;margin-top:auto;padding:8px 20px 20px}
@media (max-width:767px){
  .cui-drawer-description{font-size:var(--font-text-md-size);line-height:var(--font-text-md-line-height)}
}

/* The iOS card stack: while a modal bottom sheet is up on a phone the page behind ([data-cui-indent]: the app shell, or
   a plain page's main wrapper) shrinks to .94, drops under the status bar and rounds its corners over black; it follows
   the sheet while dragged and springs back on close. The values come from window.camosSheetStack (cui-drawer.js and
   the dashboard's lib/sheet-stack.ts) as inherited variables, so this works inside the shell's shadow root too. */
[data-cui-indent]{transform:var(--sheet-stack-transform,none);clip-path:var(--sheet-stack-clip,none);transform-origin:50% 0;
  transition:transform var(--sheet-stack-dur,var(--cui-drawer-spring-ms,520ms)) var(--cubic-enter),clip-path var(--sheet-stack-dur,450ms) var(--cubic-enter)}
html[data-sheet-stack],html[data-sheet-stack] body,html[data-sheet-stack] #app{background:var(--color-background-primary-solid)}

@media (prefers-reduced-motion:reduce){
  .cui-drawer{transition:opacity .2s var(--transition-ease-basic)}
  .cui-drawer:is([data-starting-style],[data-ending-style]){transform:translate3d(var(--translate-x,0px),var(--translate-y,0px),0);opacity:0}
  .cui-drawer-backdrop{transition:opacity .2s var(--transition-ease-basic)}
}
:is([data-motion=reduce]) .cui-drawer{transition:opacity .2s var(--transition-ease-basic)}
:is([data-motion=reduce]) .cui-drawer:is([data-starting-style],[data-ending-style]){transform:translate3d(var(--translate-x,0px),var(--translate-y,0px),0);opacity:0}
}
