/* The colors and background a person picks on their profile.
   Meadow, the colors everyone starts with, lives in app/assets/tailwind/application.css.
   The other themes below change the main colors and the page tint.
   Green, yellow and red keep their meaning in every theme. */
[data-theme="ocean"] {
  --color-base-100: oklch(99% 0.004 230);
  --color-base-200: oklch(94% 0.012 230);
  --color-base-300: oklch(88% 0.016 230);
  --color-primary: oklch(55% 0.12 245);
  --color-secondary: oklch(80% 0.07 235);
  --color-secondary-content: oklch(32% 0.08 245);
  --color-accent: oklch(64% 0.11 215);
  --color-accent-content: oklch(25% 0.06 245);
  --color-neutral: oklch(30% 0.05 250);
}

[data-theme="sunset"] {
  --color-base-100: oklch(99% 0.006 60);
  --color-base-200: oklch(94% 0.016 55);
  --color-base-300: oklch(88% 0.022 55);
  --color-primary: oklch(55% 0.15 40);
  --color-secondary: oklch(82% 0.08 55);
  --color-secondary-content: oklch(34% 0.09 40);
  --color-accent: oklch(66% 0.14 25);
  --color-accent-content: oklch(26% 0.07 35);
  --color-neutral: oklch(31% 0.04 35);
}

[data-theme="lavender"] {
  --color-base-100: oklch(99% 0.005 300);
  --color-base-200: oklch(94% 0.014 300);
  --color-base-300: oklch(88% 0.02 300);
  --color-primary: oklch(55% 0.14 295);
  --color-secondary: oklch(81% 0.07 300);
  --color-secondary-content: oklch(33% 0.09 295);
  --color-accent: oklch(64% 0.13 320);
  --color-accent-content: oklch(25% 0.07 295);
  --color-neutral: oklch(30% 0.05 290);
}

[data-theme="slate"] {
  --color-base-100: oklch(99% 0.002 250);
  --color-base-200: oklch(94% 0.006 250);
  --color-base-300: oklch(88% 0.01 250);
  --color-primary: oklch(45% 0.04 255);
  --color-secondary: oklch(82% 0.02 250);
  --color-secondary-content: oklch(30% 0.03 255);
  --color-accent: oklch(66% 0.06 230);
  --color-accent-content: oklch(22% 0.03 255);
  --color-neutral: oklch(27% 0.025 255);
}

/* Background patterns a person can pick on their profile (User#background_pattern).
   Each one is drawn behind the page in the theme's own colors: the pattern in
   primary, and the playful ones' sprinkles in accent. The shapes are SVG masks,
   so the colors always come from the theme. */
:where([data-background-pattern]:not([data-background-pattern="plain"])) {
  isolation: isolate;
  /* Reset here so a preview tile never borrows the page's sprinkles. */
  --pattern-sprinkles: linear-gradient(transparent, transparent);
}

:where([data-background-pattern]:not([data-background-pattern="plain"]))::before,
:where([data-background-pattern]:not([data-background-pattern="plain"]))::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  mask-repeat: repeat;
  mask-size: var(--pattern-size);
}

:where([data-background-pattern]:not([data-background-pattern="plain"]))::before {
  background-color: color-mix(in oklab, var(--color-primary) 18%, transparent);
  mask-image: var(--pattern);
}

:where([data-background-pattern]:not([data-background-pattern="plain"]))::after {
  background-color: color-mix(in oklab, var(--color-accent) 25%, transparent);
  mask-image: var(--pattern-sprinkles);
}

/* Behind the whole page, the pattern stays put while the page scrolls. */
body[data-background-pattern]::before,
body[data-background-pattern]::after {
  position: fixed;
}

@media print {
  [data-background-pattern]::before,
  [data-background-pattern]::after {
    display: none;
  }
}

[data-background-pattern="dots"] {
  --pattern-size: 22px;
  --pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='white'><circle cx='11' cy='11' r='2.2'/></svg>");
}

[data-background-pattern="grid"] {
  --pattern-size: 32px;
  --pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' fill='white'><path d='M0 .5H32M.5 0V32' fill='none' stroke='white'/></svg>");
}

[data-background-pattern="waves"] {
  --pattern-size: 64px 20px;
  --pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='64' height='20' fill='white'><path d='M0 10q8-8 16 0t16 0t16 0t16 0' fill='none' stroke='white' stroke-width='1.6'/></svg>");
}

[data-background-pattern="confetti"] {
  --pattern-size: 96px;
  --pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='96' height='96' fill='white'><rect x='10' y='12' width='10' height='4' rx='1' transform='rotate(30 15 14)'/><rect x='60' y='20' width='10' height='4' rx='1' transform='rotate(-40 65 22)'/><rect x='30' y='62' width='10' height='4' rx='1' transform='rotate(70 35 64)'/><rect x='76' y='70' width='10' height='4' rx='1' transform='rotate(15 81 72)'/></svg>");
  --pattern-sprinkles: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='96' height='96' fill='white'><circle cx='42' cy='26' r='3'/><circle cx='86' cy='44' r='2.5'/><circle cx='12' cy='84' r='3'/><path d='M50 84q4-6 8 0t8 0' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round'/><path d='M8 44q4-6 8 0t8 0' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round'/></svg>");
}

[data-background-pattern="stars"] {
  --pattern-size: 90px;
  --pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='90' height='90' fill='white'><polygon points='20.0,13.0 22.2,18.9 28.6,19.2 23.6,23.2 25.3,29.3 20.0,25.8 14.7,29.3 16.4,23.2 11.4,19.2 17.8,18.9'/><polygon points='64.0,53.0 65.8,57.6 70.7,57.8 66.9,60.9 68.1,65.7 64.0,63.0 59.9,65.7 61.1,60.9 57.3,57.8 62.2,57.6'/></svg>");
  --pattern-sprinkles: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='90' height='90' fill='white'><polygon points='66.0,18.0 62.8,18.8 62.0,22.0 61.2,18.8 58.0,18.0 61.2,17.2 62.0,14.0 62.8,17.2'/><polygon points='21.5,68.0 18.7,68.7 18.0,71.5 17.3,68.7 14.5,68.0 17.3,67.3 18.0,64.5 18.7,67.3'/><circle cx='84' cy='84' r='1.5'/><circle cx='40' cy='44' r='1.5'/></svg>");
}

[data-background-pattern="hearts"] {
  --pattern-size: 80px;
  --pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80' fill='white'><path transform='translate(6 6) scale(0.75)' d='M12 21C5 16 2 12.5 2 8.5A4.5 4.5 0 0 1 12 6a4.5 4.5 0 0 1 10 2.5C22 12.5 19 16 12 21z'/><path transform='translate(46 46) scale(0.6)' d='M12 21C5 16 2 12.5 2 8.5A4.5 4.5 0 0 1 12 6a4.5 4.5 0 0 1 10 2.5C22 12.5 19 16 12 21z'/></svg>");
  --pattern-sprinkles: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80' fill='white'><circle cx='58' cy='16' r='2.5'/><circle cx='18' cy='60' r='2'/><circle cx='70' cy='34' r='1.5'/></svg>");
}

[data-background-pattern="paws"] {
  --pattern-size: 90px;
  --pattern: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='90' height='90' fill='white'><g transform='translate(24 26) rotate(-20)'><ellipse cx='0' cy='6' rx='7' ry='6'/><circle cx='-8' cy='-3' r='3'/><circle cx='-3' cy='-8' r='3'/><circle cx='3' cy='-8' r='3'/><circle cx='8' cy='-3' r='3'/></g><g transform='translate(66 68) rotate(20)'><ellipse cx='0' cy='6' rx='7' ry='6'/><circle cx='-8' cy='-3' r='3'/><circle cx='-3' cy='-8' r='3'/><circle cx='3' cy='-8' r='3'/><circle cx='8' cy='-3' r='3'/></g></svg>");
}
