/* Studio editor of the Unisson model (studio-editeur.html): the calm aurora and the grain of the documentation pages,
   then the .container.wide, .head and .tool rules, selectors moved into the shadow tree, colours read from the
   --pack-* tokens. The header above is 64 px high (--top-h of the model): the preview sticks 14 px under it. */
:host {
  --top-h: 64px;
  display: block;
  position: relative;
  max-inline-size: none;
  color: var(--pack-ink);
  font:
    16px / 1.6 Inter,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  font-feature-settings: normal;
  letter-spacing: normal;
  -webkit-font-smoothing: antialiased;
}
:host([hidden]) {
  display: none;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Aurora, calmer than the home for reading (opacity .7), and the dotted grain: fixed behind the whole page. */
.aurora,
.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.aurora {
  overflow: hidden;
  opacity: 0.7;
}
.aurora i {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}
.aurora i:nth-child(1) {
  inline-size: 70vmax;
  block-size: 70vmax;
  inset-inline-start: -20vmax;
  inset-block-start: -30vmax;
  background: radial-gradient(closest-side, var(--pack-a1), transparent 70%);
}
.aurora i:nth-child(2) {
  inline-size: 80vmax;
  block-size: 80vmax;
  inset-inline-end: -30vmax;
  inset-block-start: -10vmax;
  background: radial-gradient(closest-side, var(--pack-a2), transparent 70%);
}
.aurora i:nth-child(3) {
  inline-size: 70vmax;
  block-size: 70vmax;
  inset-inline-start: 20vmax;
  inset-block-end: -45vmax;
  background: radial-gradient(closest-side, var(--pack-a3), transparent 70%);
}
@keyframes drift1 {
  to {
    transform: translate3d(8vmax, 6vmax, 0) scale(1.1);
  }
}
@keyframes drift2 {
  to {
    transform: translate3d(-9vmax, 8vmax, 0) scale(0.92);
  }
}
.grain {
  opacity: 0.5;
  background-image: radial-gradient(var(--pack-line) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 20%, var(--pack-ink), transparent 70%);
  mask-image: radial-gradient(ellipse at 50% 20%, var(--pack-ink), transparent 70%);
}

/* .container.wide */
[part="main"] {
  display: block;
  inline-size: min(1408px, 100% - 32px);
  margin-inline: auto;
}
/* The slotted hosts carry the editor's anchors (#reglages, #choix, #apercu, #contraste, #export): clear of the
   sticky header, as the model's headings. */
::slotted(*) {
  scroll-margin-block-start: 96px;
}
/* .head: 30 px above the page head and its callout. */
[part="head"] {
  padding-block-start: 30px;
}

/* .tool: controls and picker on the left, the sticky preview in the middle, the aside on the right. */
[part="tool"] {
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr) 344px;
  grid-template-areas:
    "ctl prev out"
    "pick prev out";
  gap: 20px;
  align-items: start;
  margin-block-start: 26px;
}
[part="controls"] {
  grid-area: ctl;
  min-inline-size: 0;
}
[part="picker"] {
  grid-area: pick;
  min-inline-size: 0;
}
[part="preview"] {
  grid-area: prev;
  position: sticky;
  inset-block-start: calc(var(--top-h) + 14px);
  min-inline-size: 0;
}
[part="aside"] {
  grid-area: out;
  display: grid;
  gap: 20px;
  min-inline-size: 0;
}

@media (max-width: 1279px) {
  [part="tool"] {
    grid-template-columns: 300px minmax(0, 1fr);
    grid-template-areas:
      "ctl prev"
      "pick prev"
      "out out";
  }
  [part="aside"] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
}
@media (max-width: 899px) {
  [part="tool"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "prev"
      "ctl"
      "pick"
      "out";
  }
  [part="preview"] {
    position: static;
  }
  [part="aside"] {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Motion: the drifting aurora, only when allowed. */
@media (prefers-reduced-motion: no-preference) {
  .aurora i:nth-child(1) {
    animation: drift1 26s ease-in-out infinite alternate;
  }
  .aurora i:nth-child(2) {
    animation: drift2 32s ease-in-out infinite alternate;
  }
  .aurora i:nth-child(3) {
    animation: drift1 38s ease-in-out infinite alternate-reverse;
  }
}

/* Forced colours: no decorative light. */
@media (forced-colors: active) {
  .aurora,
  .grain {
    display: none;
  }
}
