/* 2026-11 paper pass. The floating controls are things from the sketchbook: the navigation is a paper
   label taped to the page, the selected item is a strip of washi tape, the filter is a row of labels with
   an inked stamp on the chosen one.
   Round 2: glass.css is gone and what it still did lives here (sticky header, the brand slip after you
   scroll, the phone filter row and header). No backdrop blur anywhere. Removing this <link> leaves the
   earlier layers (glass-preview.css and before) with a plain, non-sticky header. */

:root{
 --paper:#fffaf2;
 --paper-edge:#dccfbf;
 --paper-grain:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .33 0 0 0 0 .25 0 0 0 .32 -.13'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
 --paper-lift:0 1px 0 #fff inset,0 1px 2px #5f4a351f,0 10px 22px -12px #5f4a3552;
 --tape-sand:#d6bca3b8;
 --tape-pink:#e8bfc4c7;
 --stamp:#9b5361;
 --pencil-line:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='6' preserveAspectRatio='none'%3E%3Cpath d='M1 4 C 10 1, 18 5, 28 3 S 48 1, 59 4' fill='none' stroke='%239d5158' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E");
 --tear:polygon(0 22%,3.5% 31%,0 40%,3.5% 50%,0 60%,3.5% 69%,0 78%,100% 78%,96.5% 69%,100% 60%,96.5% 50%,100% 40%,96.5% 31%,100% 22%);
}

/* ---------- The header floats once you scroll (html.is-scrolled from glass.js) ---------- */
body .gallery-header{position:sticky;top:10px;z-index:40;pointer-events:none}
body .gallery-header>*{pointer-events:auto}
.gallery-brand{transition:background-color .3s ease,padding .3s ease}
.is-scrolled .gallery-brand{position:relative;isolation:isolate;padding:6px 14px 6px 7px}
.is-scrolled .gallery-brand small{display:none}
.gallery-nav,.gallery-filters,.sketch-dialog-header{position:relative;isolation:isolate}
.chapter-tab{isolation:isolate}

/* ---------- The material: opaque paper with grain, a pencil-thin edge and the shadow of something lying on a page ---------- */
.gallery-nav,.gallery-filters,.sketch-dialog-header,.chapter-tab,.is-scrolled .gallery-brand{
 background:var(--paper-grain),var(--paper);
 border:1px solid var(--paper-edge);
 box-shadow:var(--paper-lift);
 border-radius:4px 3px 6px 3px;
}
/* polish.css rounds the phone filter row with !important. */
.gallery-filters{border-radius:4px 3px 6px 3px!important}
/* chapters.css darkens the tab edge on hover; paper keeps its pencil edge. */
.chapter-tab:hover{border-color:var(--paper-edge)}

/* The navigation's two pseudo-elements are pieces of tape. */
.gallery-nav:before,.gallery-nav:after{
 content:'';display:block;position:absolute;top:-9px;z-index:2;
 width:48px;height:17px;padding:0;border-radius:1px;pointer-events:none;
 background:var(--tape-sand);
}
.gallery-nav:before{left:16px;transform:rotate(-7deg)}
.gallery-nav:after{right:20px;width:42px;background:var(--tape-pink);transform:rotate(5deg)}

/* Navigation: plain labels; hovering pencils a line under one, the current page is taped over. */
.gallery-nav{rotate:-.35deg}
.gallery-nav a,.gallery-filters button{border-radius:3px}
.gallery-nav a{background:var(--pencil-line) no-repeat 14px calc(100% - 9px)/0 6px}
.gallery-nav a:hover,.gallery-nav a:focus-visible{background:var(--pencil-line) no-repeat 14px calc(100% - 9px)/calc(100% - 28px) 6px}
.gallery-nav.has-sliding-capsule a[aria-current],.gallery-nav.has-sliding-capsule a.nav-preview{background:none}
.gallery-nav .nav-capsule{
 background:var(--tape-pink);border:0;box-shadow:none;border-radius:0;
 rotate:-1.6deg;
 /* a torn strip, shorter than the label it sits on */
 clip-path:var(--tear);
}
.gallery-nav.is-nav-dragging .nav-capsule{box-shadow:none}
/* Before glass-preview.js adds the sliding strip, the current link already wears the same tape, so the
   first paint is not a white box. It lines up with where the strip will be drawn. */
.gallery-nav:not(.has-sliding-capsule) a[aria-current]{position:relative;z-index:1;background:none;box-shadow:none}
.gallery-nav:not(.has-sliding-capsule) a[aria-current]:before{content:'';position:absolute;inset:0;z-index:-1;pointer-events:none;background:var(--tape-pink);rotate:-1.6deg;clip-path:var(--tear)}

/* Filters: the chosen category is stamped in ink. */
.gallery-filters .filter-capsule{
 background:
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .96 0 0 0 0 .94 0 0 0 .9 -.52'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
  var(--stamp);
 border:0;border-radius:3px 2px 4px 2px;
 box-shadow:0 0 0 1.5px var(--stamp),0 5px 12px -6px #8c4655a6;
 rotate:-1.1deg;
}
.gallery-filters.is-filter-dragging .filter-capsule{box-shadow:0 0 0 1.5px var(--stamp),0 9px 18px -7px #8c4655b3}
.gallery-filters button:hover:not([aria-pressed=true]){background:#d6bca338}

/* Viewer strip and the corner tab are slips of the same paper. */
.sketch-dialog-header button{border-radius:3px}
.sketch-dialog-header button:hover{background:#d6bca338}
.sketch-dialog-header button[data-viewer=close]{background:#f8ece9;border:1px solid #e2c7c9;box-shadow:none;border-radius:3px 2px 4px 2px}
.chapter-tab{rotate:-1deg}

/* The toy and workbench tabs, and the native file picker, join the stationery. */
.toy-tabs button,.workbench-tabs button,[role=tablist] button[role=tab]{border-radius:3px 2px 4px 2px}
input[type=file]::file-selector-button{margin-right:10px;padding:7px 12px;border:1px solid var(--paper-edge);border-radius:3px 2px 4px 2px;background:var(--paper);color:#7d3a48;font:inherit;font-size:12px;cursor:pointer}
input[type=file]::file-selector-button:hover{background:#f8ece9}

/* ---------- Phones ---------- */
@media(max-width:700px){
 /* The filters fit on one line (polish.css and glass-preview.css set a grid and padding with !important). */
 .gallery-filters,.gallery-filters.has-filter-capsule{display:flex!important;grid-template-columns:none;flex-wrap:nowrap;gap:0;padding:4px}
 .gallery-filters.has-filter-capsule button,.gallery-filters button{flex:1 1 auto;width:auto;min-width:0;padding:10px 4px!important;font-size:12.5px!important;white-space:nowrap}
 /* Only the navigation row floats; the brand row scrolls away. */
 body .gallery-header{top:6px;transition:transform .28s cubic-bezier(.22,.7,.25,1)}
 .is-scrolled body .gallery-header{transform:translateY(calc(var(--header-shift,0px) * -1))}
 .is-scrolled .gallery-brand{opacity:0;pointer-events:none}
 .gallery-nav{rotate:none}
 .gallery-nav:before{left:10px;width:38px;height:14px;top:-7px}
 .gallery-nav:after{right:12px;width:34px;height:14px;top:-7px}
 .gallery-nav a{background-position:8px calc(100% - 8px)}
 .gallery-nav a:hover,.gallery-nav a:focus-visible{background-size:calc(100% - 16px) 6px}
 .chapter-tab{rotate:none}
}
@media(max-width:350px){
 .gallery-filters,.gallery-filters.has-filter-capsule{display:grid!important;grid-template-columns:repeat(3,1fr)}
}

@media(prefers-reduced-motion:reduce){.gallery-nav a{transition:none}}
@media(forced-colors:active),(prefers-contrast:more){
 .gallery-nav,.gallery-filters,.sketch-dialog-header,.chapter-tab,.is-scrolled .gallery-brand{background:Canvas;color:CanvasText;border:1px solid CanvasText;box-shadow:none;rotate:none}
 .gallery-nav:before,.gallery-nav:after,.gallery-nav:not(.has-sliding-capsule) a[aria-current]:before{display:none}
 .gallery-nav a,.gallery-nav a:hover,.gallery-nav a:focus-visible{background:none}
 .chapter-tab:hover{border-color:CanvasText}
 .gallery-filters .filter-capsule,.gallery-filters.is-filter-dragging .filter-capsule{background:Highlight;box-shadow:none;rotate:none}
 .gallery-nav .nav-capsule{background:Canvas;border:2px solid Highlight;clip-path:none;rotate:none}
}
