/* ===== the paper (Marijana Pav's texture), one sheet for the whole site: page and top bar share the same fixed tile ===== */
:root{--paper-tex:url("data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="320" height="320"%3E%3Cfilter id="p" x="0" y="0" width="100%25" height="100%25"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="5" stitchTiles="stitch" result="n"/%3E%3CfeDiffuseLighting in="n" lighting-color="white" surfaceScale="2"%3E%3CfeDistantLight azimuth="45" elevation="60"/%3E%3C/feDiffuseLighting%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(#p)" opacity="0.2"/%3E%3C/svg%3E")}
html.night{--paper-tex:url("data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="320" height="320"%3E%3Cfilter id="p" x="0" y="0" width="100%25" height="100%25"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="5" stitchTiles="stitch" result="n"/%3E%3CfeDiffuseLighting in="n" lighting-color="white" surfaceScale="2"%3E%3CfeDistantLight azimuth="45" elevation="60"/%3E%3C/feDiffuseLighting%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(#p)" opacity="0.06"/%3E%3C/svg%3E")}
body{background-image:var(--paper-tex)!important;background-attachment:fixed!important}
header.top,body.scrolled header.top,body.scrolled:has(main.home) header.top{background-color:var(--paper)!important;background-image:var(--paper-tex)!important;background-attachment:fixed!important;backdrop-filter:none!important;-webkit-backdrop-filter:none!important}

/* ===== (experiment) the paper, as Marijana Pav actually lays it: not only behind the page but OVER it — one sheet of
   lit noise across everything (cards, covers, panels), 20% strong, untouchable. Her site: .grain::before
   {filter:url(#paperFilter);opacity:.2;z-index:2}. The same filter is rendered here as a stitched tile so it costs
   nothing on scroll, and it is fixed to the viewport like a sheet laid over the screen. ===== */
html:not(.night){--paper:#F5F3EE;--line:rgba(60,48,36,.13)}   /* warm umber paper, kept off the red (was #FCFBF7; #F2E9DF read too peach) */
html:not(.night) body{background-color:var(--paper)!important}
body::after{content:"";position:fixed;inset:0;z-index:2147483000;pointer-events:none;
  background-image:var(--paper-tex);background-repeat:repeat;opacity:1}
/* the tile already carries its 20% (6% at night); multiply keeps the paper's warmth under the light/shadow of the grain */
html:not(.night) body::after{mix-blend-mode:multiply}
/* the sheet on top replaces the tiles underneath (they'd double the grain) */
body,header.top,body.scrolled header.top,body.scrolled:has(main.home) header.top{background-image:none!important}
/* the inline data-URI tile above never rendered (unescaped quotes inside url("…")); the same tile, as real files */
:root{--paper-tex:url("img/paper-soft.svg?v=3")}
html.night{--paper-tex:url("img/paper-night.svg")}
/* the sheet goes BEHIND the content: books sit on the paper, not under it. Surfaces that paint their own colour
   (top bar, the home panel, the All books cards, pills) carry the same fixed tile, so the grain runs through them
   unbroken while covers stay clean */
body::after{z-index:-1}
html body header.top,html body.scrolled header.top,html body.scrolled:has(main.home) header.top,
.booksp .abc,.booksp .abpill,.tabbar,.siderail{
  background-image:var(--paper-tex)!important;background-attachment:fixed!important;background-repeat:repeat!important}
/* one method everywhere: the fixed tile as a background on the page and on each surface (no overlay at all) */
body::after{content:none!important}
html body{background-image:var(--paper-tex)!important;background-attachment:fixed!important;background-repeat:repeat!important}
/* the paper runs to the bottom of the window on short pages too (the body paints the grain; html has its own flat colour) */
html{background-image:var(--paper-tex)!important;background-attachment:fixed!important;background-repeat:repeat!important}
