/**
 * Subtle full-page background pattern that changes with the selected
 * theme (pirate gets skull-and-crossbones, robot gets a circuit trace,
 * cat gets a paw print, etc - see app.js's updateThemeBackground()).
 *
 * .theme-backdrop is a fixed, full-viewport layer using CSS masking, not
 * a plain background-image: the mask has two layers - a tiled icon SVG
 * and a top-to-bottom gradient - composited with `intersect`, so the
 * icon pattern is visible near the top of the page and fades to nothing
 * before it reaches the bottom, rather than stopping at a hard edge.
 * The visible color comes from --ds-color-text at low opacity, so it's
 * one shape per theme but the color still adapts to light/dark
 * automatically - no separate light/dark SVGs needed.
 */

body {
    --theme-pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><path d='M32 18v30' stroke='%23000' stroke-width='2.5' stroke-linecap='round'/><g fill='%23000'><ellipse cx='24' cy='24' rx='6' ry='3' transform='rotate(-30 24 24)'/><ellipse cx='40' cy='24' rx='6' ry='3' transform='rotate(30 40 24)'/><ellipse cx='22' cy='34' rx='6' ry='3' transform='rotate(-15 22 34)'/><ellipse cx='42' cy='34' rx='6' ry='3' transform='rotate(15 42 34)'/><ellipse cx='24' cy='44' rx='6' ry='3' transform='rotate(-30 24 44)'/><ellipse cx='40' cy='44' rx='6' ry='3' transform='rotate(30 40 44)'/></g></svg>");
}

.theme-backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-color: var(--ds-color-text);
    opacity: 0.06;
    mask-image: var(--theme-pattern), linear-gradient(to bottom, #000 0%, #000 20%, transparent 65%);
    mask-repeat: repeat, no-repeat;
    mask-size: 64px 64px, 100% 100%;
    mask-composite: intersect;
    -webkit-mask-image: var(--theme-pattern), linear-gradient(to bottom, #000 0%, #000 20%, transparent 65%);
    -webkit-mask-repeat: repeat, no-repeat;
    -webkit-mask-size: 64px 64px, 100% 100%;
    -webkit-mask-composite: source-in;
}

body[data-pattern='classic'] {
    --theme-pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><path d='M32 18v30' stroke='%23000' stroke-width='2.5' stroke-linecap='round'/><g fill='%23000'><ellipse cx='24' cy='24' rx='6' ry='3' transform='rotate(-30 24 24)'/><ellipse cx='40' cy='24' rx='6' ry='3' transform='rotate(30 40 24)'/><ellipse cx='22' cy='34' rx='6' ry='3' transform='rotate(-15 22 34)'/><ellipse cx='42' cy='34' rx='6' ry='3' transform='rotate(15 42 34)'/><ellipse cx='24' cy='44' rx='6' ry='3' transform='rotate(-30 24 44)'/><ellipse cx='40' cy='44' rx='6' ry='3' transform='rotate(30 40 44)'/></g></svg>");
}

body[data-pattern='pirate'] {
    --theme-pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g fill='%23000'><circle cx='32' cy='24' r='9'/><rect x='27' y='31' width='10' height='6' rx='2'/></g><g stroke='%23000' stroke-width='3' stroke-linecap='round'><path d='M18 44l28 10M46 44l-28 10'/></g></svg>");
}

body[data-pattern='robot'] {
    --theme-pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='M18 24h10v-8h10'/><path d='M18 40h10v8h10'/><path d='M38 32h10'/></g><g fill='%23000'><circle cx='18' cy='24' r='2.5'/><circle cx='38' cy='16' r='2.5'/><circle cx='18' cy='40' r='2.5'/><circle cx='38' cy='48' r='2.5'/><circle cx='48' cy='32' r='2.5'/></g></svg>");
}

body[data-pattern='coffee'] {
    --theme-pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='M20 30h18v10a9 9 0 0 1-18 0z'/><path d='M38 32h4a4 4 0 0 1 0 8h-4'/><path d='M25 26c0-3 2-3 2-6M31 26c0-3 2-3 2-6'/></g></svg>");
}

body[data-pattern='corporate'] {
    --theme-pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g fill='%23000'><rect x='18' y='34' width='6' height='12'/><rect x='29' y='26' width='6' height='20'/><rect x='40' y='18' width='6' height='28'/></g><path d='M16 46h32' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'/></svg>");
}

body[data-pattern='cat'] {
    --theme-pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g fill='%23000'><ellipse cx='32' cy='38' rx='10' ry='8'/><circle cx='20' cy='24' r='4'/><circle cx='29' cy='19' r='4'/><circle cx='39' cy='19' r='4'/><circle cx='47' cy='24' r='4'/></g></svg>");
}

body[data-pattern='metal'] {
    --theme-pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><path d='M34 16l-14 20h9l-5 14 16-20h-9z' fill='%23000'/></svg>");
}

body[data-pattern='bureaucracy'] {
    --theme-pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><circle cx='32' cy='32' r='12'/><path d='M26 32l4 4 8-9'/></g></svg>");
}

body[data-pattern='noir'] {
    --theme-pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g fill='%23000'><rect x='14' y='20' width='36' height='4'/><rect x='14' y='30' width='36' height='4'/><rect x='14' y='40' width='36' height='4'/></g></svg>");
}

body[data-pattern='startup'] {
    --theme-pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g fill='%23000'><path d='M32 14c6 6 8 14 8 20 0 4-3 6-8 6s-8-2-8-6c0-6 2-14 8-20z'/><path d='M24 34l-6 8 8-2z'/><path d='M40 34l6 8-8-2z'/></g></svg>");
}

body[data-pattern='fantasy'] {
    --theme-pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><path d='M32 14L46 20V32L32 50L18 32V20Z' fill='none' stroke='%23000' stroke-width='2.5' stroke-linejoin='round'/><path d='M32 24v16M25 32h14' stroke='%23000' stroke-width='2.5' stroke-linecap='round'/></svg>");
}

body[data-pattern='gamer'] {
    --theme-pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><g fill='%23000'><rect x='27' y='16' width='10' height='10'/><rect x='27' y='38' width='10' height='10'/><rect x='16' y='27' width='10' height='10'/><rect x='38' y='27' width='10' height='10'/><rect x='27' y='27' width='10' height='10'/></g></svg>");
}

body[data-pattern='wellness'] {
    --theme-pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><path d='M44 20a16 16 0 1 1 -6-4' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round'/></svg>");
}

body[data-pattern='conspiracy'] {
    --theme-pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><path d='M14 32c6-8 12-12 18-12s12 4 18 12c-6 8-12 12-18 12s-12-4-18-12z' fill='none' stroke='%23000' stroke-width='2.5' stroke-linejoin='round'/><circle cx='32' cy='32' r='6' fill='%23000'/></svg>");
}

body[data-pattern='surfer'] {
    --theme-pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><path d='M14 38c4-6 8-6 12 0s8 6 12 0 8-6 12 0 8 6 12 0' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'/></svg>");
}
