/* Generated by tools/textures/make_textures.py: page backgrounds (Settings -> Appearance -> Backgrounds). */

:root {
    --panel-alpha: 100%;
    --panel-blur: 0;
    --tex-grain: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    --tex-glow: 14%;
}

:root[data-theme="dark"] {
    --tex-grain: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.045 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    --tex-glow: 24%;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
    --tex-grain: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.045 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    --tex-glow: 24%;
    --tms-hex-tile: url("../t/img/bg/hexagon-dark.svg");
    --tms-hex-base: #000;
    --tms-hex-blend: screen;
    --tms-hex-o: .2;
    }
}

/* ---- the layer: fixed behind the page (the hexagons: over it, t/css/tms-backgrounds.css), shown with a background
   on. The page colour stays on <html>; body lets the layer through. ---- */

.tc-bgfx {
    display: none;
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    contain: strict;
    /* The portal's art is measured in cqw/cqh (a preview is the same drawing, the page shrunk). */
    container-type: size;
}

html[data-texture] .tc-bgfx {
    display: block;
}

html[data-texture] body {
    background: transparent;
}

/* ---- webmail's own textures (on the layer's art element, and in the previews) ---- */

.tms-bgart.tex-halftone {
    background-image:
        radial-gradient(circle at 100% 0%, transparent 0, var(--bg) 70%),
        radial-gradient(circle, color-mix(in srgb, var(--accent) 34%, transparent) 1.1px, transparent 1.5px);
    background-size: 100% 100%, 10px 10px;
}

.tms-bgart.tex-grain {
    background-image: var(--tex-grain);
}

.tms-bgart.tex-aurora-grain {
    background-image:
        var(--tex-grain),
        radial-gradient(60% 70% at 6% 0%, color-mix(in srgb, var(--accent) var(--tex-glow), transparent), transparent 70%),
        radial-gradient(50% 60% at 100% 100%, color-mix(in srgb, #7c5cd6 var(--tex-glow), transparent), transparent 70%),
        radial-gradient(40% 45% at 92% 6%, color-mix(in srgb, #22b3c9 calc(var(--tex-glow) * .7), transparent), transparent 70%);
}

/* ---- previews in Settings: the page shrunk (.tms-bgbox: a size container), its mock panels drawn by the page ---- */

.tex-preview {
    position: relative;
    overflow: hidden;
    background-color: var(--bg);
}

    .tex-preview.tms-bgprev::after {
        display: none;
    }

/* ---- see-through panels (Panel opacity, "Show the background through cards and panels"): mail pages ---- */

html[data-panels] .panel {
    background: color-mix(in srgb, var(--surface) var(--panel-alpha), transparent);
}

html[data-panels] .list .grp, html[data-panels] .list .subhead {
    background: color-mix(in srgb, var(--surface-2) var(--panel-alpha), transparent);
}

/* ---- frosted panels (Card blur, 0-100: 0-20px). As on the portal the frost is an empty layer behind the panel's
   content (its ::after), never a backdrop-filter on the panel itself: that would make the panel the containing block
   of every position:fixed menu and dialog inside it. 0 draws nothing. ---- */

:where(html[data-panels][data-panel-blur]) :where(.panel) {
    position: relative;
}

html[data-panels][data-panel-blur] .panel::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    pointer-events: none;
    -webkit-backdrop-filter: blur(calc(var(--panel-blur) * .2px));
    backdrop-filter: blur(calc(var(--panel-blur) * .2px));
}

/* ---- dialogs stay solid (user, 21 Oct 2026: "make it opaque"): a .panel that is a dialog floats over the page, so the
   wallpaper and the calendar or mail behind it would show through it and its fields. Panel opacity is for the panes
   of a page, never for a dialog or popover on top of it: full surface, no frost layer. ---- */

html[data-panels] .panel:is([role="dialog"], [role="alertdialog"], [aria-modal="true"]) {
    background: var(--surface);
}

html[data-panels][data-panel-blur] .panel:is([role="dialog"], [role="alertdialog"], [aria-modal="true"])::after {
    display: none;
}

@media (prefers-reduced-transparency: reduce) {
    html[data-panels] .panel { background: var(--surface); }
    html[data-panels][data-panel-blur] .panel::after { display: none; }
}

/* Printing: plain paper. */
@media print {
    html[data-panels] .panel { background: #fff; }
    .tc-bgfx { display: none !important; }
}

/* The sign-in pages stay plain whatever the saved look (boot.js and theme.js also skip them). */
html:has(main.login) .tc-bgfx { display: none !important; }
html:has(main.login) body { background: var(--bg); }
