/* deck-foundation v1 backgrounds: a system where each background has one job.

   | Slide job                 | Background                          | Markup (first children of the slide)                          |
   |---------------------------|-------------------------------------|----------------------------------------------------------------|
   | Title, closing            | silk lines                          | <div class="motif motif--silk"></div>                          |
   |                           | closing: flipped                    | <div class="motif motif--silk motif--flip"></div>              |
   | Section break             | mesh gradient                       | <div class="motif motif--mesh"></div>                          |
   | Content (most slides)     | calm dot matrix, or nothing         | <div class="motif motif--dots"></div>                          |
   | Key model / the system    | console frame                       | <div class="motif motif--console"></div>                       |
   | Quote, commitment         | frosted glass over full mesh        | <div class="motif motif--mesh-full"></div><div class="glass-panel"></div> |

   Rules: strong backgrounds only on bookends and section breaks; glass at most twice per talk;
   content slides stay calm. Nothing may tint the base surface itself: every slide must sit on the
   same --surface colour, so motifs only add light in their own area (no full-slide overlays;
   the one exception is mesh-full behind the glass panel, where the colour is the point). Everything is drawn from theme tokens, so it follows the deck's accent
   and works in dark and light. */

.motif {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Silk lines: dozens of thin flowing lines in the accent colour. Strength: --motif-opacity. */
.motif--silk {
  opacity: var(--motif-opacity, 0.6);
  background: linear-gradient(90deg, transparent 50%, var(--accent) 72%, var(--accent-strong));
  /* The lines, faded out across the top half so they never run behind the title. */
  -webkit-mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1920 1080' preserveAspectRatio='none'%3E%3Cg fill='none' stroke='black' stroke-width='1.3'%3E%3Cpath d='M700 520C1050 340 1350 820 1960 380'/%3E%3Cpath d='M700 529C1050 345 1350 833 1960 386'/%3E%3Cpath d='M700 538C1050 350 1350 846 1960 392'/%3E%3Cpath d='M700 547C1050 355 1350 859 1960 398'/%3E%3Cpath d='M700 556C1050 360 1350 872 1960 404'/%3E%3Cpath d='M700 565C1050 365 1350 885 1960 410'/%3E%3Cpath d='M700 574C1050 370 1350 898 1960 416'/%3E%3Cpath d='M700 583C1050 375 1350 911 1960 422'/%3E%3Cpath d='M700 592C1050 380 1350 924 1960 428'/%3E%3Cpath d='M700 601C1050 385 1350 937 1960 434'/%3E%3Cpath d='M700 610C1050 390 1350 950 1960 440'/%3E%3Cpath d='M700 619C1050 395 1350 963 1960 446'/%3E%3Cpath d='M700 628C1050 400 1350 976 1960 452'/%3E%3Cpath d='M700 637C1050 405 1350 989 1960 458'/%3E%3Cpath d='M700 646C1050 410 1350 1002 1960 464'/%3E%3Cpath d='M700 655C1050 415 1350 1015 1960 470'/%3E%3Cpath d='M700 664C1050 420 1350 1028 1960 476'/%3E%3Cpath d='M700 673C1050 425 1350 1041 1960 482'/%3E%3Cpath d='M700 682C1050 430 1350 1054 1960 488'/%3E%3Cpath d='M700 691C1050 435 1350 1067 1960 494'/%3E%3Cpath d='M700 700C1050 440 1350 1080 1960 500'/%3E%3Cpath d='M700 709C1050 445 1350 1093 1960 506'/%3E%3Cpath d='M700 718C1050 450 1350 1106 1960 512'/%3E%3Cpath d='M700 727C1050 455 1350 1119 1960 518'/%3E%3Cpath d='M700 736C1050 460 1350 1132 1960 524'/%3E%3Cpath d='M700 745C1050 465 1350 1145 1960 530'/%3E%3Cpath d='M700 754C1050 470 1350 1158 1960 536'/%3E%3Cpath d='M700 763C1050 475 1350 1171 1960 542'/%3E%3Cpath d='M700 772C1050 480 1350 1184 1960 548'/%3E%3Cpath d='M700 781C1050 485 1350 1197 1960 554'/%3E%3Cpath d='M700 790C1050 490 1350 1210 1960 560'/%3E%3Cpath d='M700 799C1050 495 1350 1223 1960 566'/%3E%3Cpath d='M700 808C1050 500 1350 1236 1960 572'/%3E%3Cpath d='M700 817C1050 505 1350 1249 1960 578'/%3E%3Cpath d='M700 826C1050 510 1350 1262 1960 584'/%3E%3Cpath d='M700 835C1050 515 1350 1275 1960 590'/%3E%3Cpath d='M700 844C1050 520 1350 1288 1960 596'/%3E%3Cpath d='M700 853C1050 525 1350 1301 1960 602'/%3E%3Cpath d='M700 862C1050 530 1350 1314 1960 608'/%3E%3Cpath d='M700 871C1050 535 1350 1327 1960 614'/%3E%3Cpath d='M700 880C1050 540 1350 1340 1960 620'/%3E%3Cpath d='M700 889C1050 545 1350 1353 1960 626'/%3E%3Cpath d='M700 898C1050 550 1350 1366 1960 632'/%3E%3Cpath d='M700 907C1050 555 1350 1379 1960 638'/%3E%3Cpath d='M700 916C1050 560 1350 1392 1960 644'/%3E%3Cpath d='M700 925C1050 565 1350 1405 1960 650'/%3E%3C/g%3E%3C/svg%3E")
      0 0 / 100% 100% no-repeat,
    linear-gradient(to bottom, transparent 42%, #000 66%);
  -webkit-mask-composite: source-in;
  mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1920 1080' preserveAspectRatio='none'%3E%3Cg fill='none' stroke='black' stroke-width='1.3'%3E%3Cpath d='M700 520C1050 340 1350 820 1960 380'/%3E%3Cpath d='M700 529C1050 345 1350 833 1960 386'/%3E%3Cpath d='M700 538C1050 350 1350 846 1960 392'/%3E%3Cpath d='M700 547C1050 355 1350 859 1960 398'/%3E%3Cpath d='M700 556C1050 360 1350 872 1960 404'/%3E%3Cpath d='M700 565C1050 365 1350 885 1960 410'/%3E%3Cpath d='M700 574C1050 370 1350 898 1960 416'/%3E%3Cpath d='M700 583C1050 375 1350 911 1960 422'/%3E%3Cpath d='M700 592C1050 380 1350 924 1960 428'/%3E%3Cpath d='M700 601C1050 385 1350 937 1960 434'/%3E%3Cpath d='M700 610C1050 390 1350 950 1960 440'/%3E%3Cpath d='M700 619C1050 395 1350 963 1960 446'/%3E%3Cpath d='M700 628C1050 400 1350 976 1960 452'/%3E%3Cpath d='M700 637C1050 405 1350 989 1960 458'/%3E%3Cpath d='M700 646C1050 410 1350 1002 1960 464'/%3E%3Cpath d='M700 655C1050 415 1350 1015 1960 470'/%3E%3Cpath d='M700 664C1050 420 1350 1028 1960 476'/%3E%3Cpath d='M700 673C1050 425 1350 1041 1960 482'/%3E%3Cpath d='M700 682C1050 430 1350 1054 1960 488'/%3E%3Cpath d='M700 691C1050 435 1350 1067 1960 494'/%3E%3Cpath d='M700 700C1050 440 1350 1080 1960 500'/%3E%3Cpath d='M700 709C1050 445 1350 1093 1960 506'/%3E%3Cpath d='M700 718C1050 450 1350 1106 1960 512'/%3E%3Cpath d='M700 727C1050 455 1350 1119 1960 518'/%3E%3Cpath d='M700 736C1050 460 1350 1132 1960 524'/%3E%3Cpath d='M700 745C1050 465 1350 1145 1960 530'/%3E%3Cpath d='M700 754C1050 470 1350 1158 1960 536'/%3E%3Cpath d='M700 763C1050 475 1350 1171 1960 542'/%3E%3Cpath d='M700 772C1050 480 1350 1184 1960 548'/%3E%3Cpath d='M700 781C1050 485 1350 1197 1960 554'/%3E%3Cpath d='M700 790C1050 490 1350 1210 1960 560'/%3E%3Cpath d='M700 799C1050 495 1350 1223 1960 566'/%3E%3Cpath d='M700 808C1050 500 1350 1236 1960 572'/%3E%3Cpath d='M700 817C1050 505 1350 1249 1960 578'/%3E%3Cpath d='M700 826C1050 510 1350 1262 1960 584'/%3E%3Cpath d='M700 835C1050 515 1350 1275 1960 590'/%3E%3Cpath d='M700 844C1050 520 1350 1288 1960 596'/%3E%3Cpath d='M700 853C1050 525 1350 1301 1960 602'/%3E%3Cpath d='M700 862C1050 530 1350 1314 1960 608'/%3E%3Cpath d='M700 871C1050 535 1350 1327 1960 614'/%3E%3Cpath d='M700 880C1050 540 1350 1340 1960 620'/%3E%3Cpath d='M700 889C1050 545 1350 1353 1960 626'/%3E%3Cpath d='M700 898C1050 550 1350 1366 1960 632'/%3E%3Cpath d='M700 907C1050 555 1350 1379 1960 638'/%3E%3Cpath d='M700 916C1050 560 1350 1392 1960 644'/%3E%3Cpath d='M700 925C1050 565 1350 1405 1960 650'/%3E%3C/g%3E%3C/svg%3E")
      0 0 / 100% 100% no-repeat,
    linear-gradient(to bottom, transparent 42%, #000 66%);
  mask-composite: intersect;
}
.motif--flip {
  transform: scaleY(-1);
}

/* Mesh gradient: large soft colour on the right, clean dark behind the text on the left. */
.motif--mesh::before,
.motif--mesh-full::before {
  content: "";
  position: absolute;
  inset: -15%;
  filter: blur(80px);
  opacity: var(--motif-opacity, 0.75);
  background:
    radial-gradient(32% 42% at 78% 28%, color-mix(in srgb, var(--accent) 70%, transparent), transparent 70%),
    radial-gradient(30% 40% at 92% 78%, color-mix(in srgb, var(--info) 60%, transparent), transparent 70%),
    radial-gradient(
      26% 34% at 62% 88%,
      color-mix(in srgb, var(--accent-strong) 55%, transparent),
      transparent 70%
    ),
    radial-gradient(22% 30% at 98% 20%, color-mix(in srgb, var(--negative) 40%, transparent), transparent 70%);
}
.motif--mesh::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--surface) 25%, transparent 70%);
}
/* Full mesh: colour across the whole slide, for behind a glass panel. */
.motif--mesh-full::before {
  opacity: var(--motif-opacity, 0.6);
  background:
    radial-gradient(30% 40% at 20% 25%, color-mix(in srgb, var(--accent) 70%, transparent), transparent 70%),
    radial-gradient(30% 40% at 85% 70%, color-mix(in srgb, var(--info) 60%, transparent), transparent 70%),
    radial-gradient(
      25% 35% at 60% 15%,
      color-mix(in srgb, var(--accent-strong) 50%, transparent),
      transparent 70%
    );
}

/* Calm dot matrix: a few dots and a soft light in the top-right corner only. */
.motif--dots {
  background: radial-gradient(
    40% 55% at 92% 8%,
    color-mix(in srgb, var(--accent) 10%, transparent),
    transparent 70%
  );
}
.motif--dots::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 22%, transparent) 1.4px, transparent 1.8px);
  background-size: 28px 28px;
  -webkit-mask: radial-gradient(45% 60% at 95% 5%, #000, transparent 72%);
  mask: radial-gradient(45% 60% at 95% 5%, #000, transparent 72%);
}

/* Console frame: an inset rounded frame with a glowing gradient edge. Widens the slide margin to sit inside it. */
.motif--console {
  background: radial-gradient(
    40% 50% at 0% 0%,
    color-mix(in srgb, var(--accent) 16%, transparent),
    transparent 70%
  );
}
.motif--console::after {
  content: "";
  position: absolute;
  inset: 28px;
  padding: 1px;
  border-radius: 28px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent) 70%, transparent),
    color-mix(in srgb, var(--ink) 10%, transparent) 35%,
    color-mix(in srgb, var(--ink) 6%, transparent) 70%,
    color-mix(in srgb, var(--info) 45%, transparent)
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box exclude,
    linear-gradient(#000 0 0);
}
.slide:has(> .motif--console),
[class*="layout-"]:has(> .motif--console) {
  --margin-x: 140px;
}

/* Frosted glass panel: sits over a full mesh; the slide's content floats above it. */
.glass-panel {
  position: absolute !important;
  inset: 120px 200px;
  pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--ink) 16%, transparent);
  border-radius: 36px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  -webkit-backdrop-filter: blur(40px) saturate(1.2);
  backdrop-filter: blur(40px) saturate(1.2);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--ink) 12%, transparent),
    0 40px 80px rgb(0 0 0 / 0.35);
}

/* Print: PDF renderers handle masks and backdrop blur inconsistently. Keep the colour (mesh),
   drop the masked details (silk, dots, console edge), and make glass a plain panel. */
@media print {
  .motif--silk,
  .motif--dots::after,
  .motif--console::after {
    display: none;
  }
  .glass-panel {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
  }
}
