/* Docs menu of the pack site (Unisson « Démarrer » model, .side): a glowing glass panel of titled link lists, the
   current page lit by a gradient and a cyan edge, folded behind a toggle under 900 px. The rules are the model's
   own, colours read from the --pack-* tokens, physical properties made logical. bythium-pack-docs makes its column
   sticky; the panel keeps the model's height cap under the 64 px header (--top-h, inherited from the layout). */
:host {
  display: block;
  min-inline-size: 0;
  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;
}
h2 {
  margin: 0;
}
:focus-visible {
  outline: 2px solid var(--pack-focus);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Glow border of the model. */
.glow {
  position: relative;
  border-radius: 18px;
  background: var(--pack-panel);
  border: 1px solid var(--pack-line);
  box-shadow: var(--pack-shadow);
}
.glow::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, var(--pack-c1), transparent 35%, transparent 65%, var(--pack-c2));
  opacity: 0.55;
  pointer-events: none;
  -webkit-mask:
    linear-gradient(var(--pack-ink) 0 0) content-box,
    linear-gradient(var(--pack-ink) 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(var(--pack-ink) 0 0) content-box exclude,
    linear-gradient(var(--pack-ink) 0 0);
}

.side {
  max-block-size: calc(100vh - var(--top-h, 64px) - 40px);
  overflow: auto;
  padding: 14px;
  border-radius: 18px;
}
.side-toggle {
  display: none;
  list-style: none;
  inline-size: 100%;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-block-size: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--pack-line2);
  background: var(--pack-panel2);
  font:
    600 13px ui-monospace,
    "JetBrains Mono",
    Menlo,
    Consolas,
    monospace;
  color: var(--pack-ink);
  text-align: start;
}
.side-toggle:hover:not(:disabled) {
  background: var(--pack-panel2);
}
.side-toggle svg {
  flex: none;
}
.side-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}
.mut-inline {
  color: var(--pack-mut);
}
[part="group-title"] {
  margin: 14px 10px 6px;
  font:
    700 11px ui-monospace,
    "JetBrains Mono",
    Menlo,
    Consolas,
    monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pack-mut);
}
[part="group-title"]:first-child {
  margin-block-start: 4px;
}
ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}
a {
  color: var(--pack-link);
}
[part~="link"] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  color: var(--pack-mut);
  text-decoration: none;
  font-size: 14.5px;
  min-block-size: 0;
}
[part~="link"]:hover {
  color: var(--pack-ink);
  background: var(--pack-panel2);
}
[part~="link"][aria-current="page"] {
  color: var(--pack-ink);
  font-weight: 700;
  background: linear-gradient(90deg, var(--pack-a1), transparent);
  box-shadow: inset 3px 0 0 var(--pack-c1);
}
[part~="link"] code {
  font:
    600 12.5px ui-monospace,
    "JetBrains Mono",
    Menlo,
    Consolas,
    monospace;
}
.lvl {
  font:
    600 10.5px ui-monospace,
    "JetBrains Mono",
    Menlo,
    Consolas,
    monospace;
  color: var(--pack-mut);
  padding: 1px 6px;
  border: 1px solid var(--pack-line2);
  border-radius: 99px;
}
.all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  text-decoration: none;
  margin-block-start: 6px;
  min-block-size: 0;
  font:
    600 13px ui-monospace,
    "JetBrains Mono",
    Menlo,
    Consolas,
    monospace;
  color: var(--pack-link);
}
.all:hover {
  color: var(--pack-ink);
  background: var(--pack-panel2);
}

/* Under 900 px the panel gives way to the toggle; the body opens below it in a panel of its own. */
@media (max-width: 899px) {
  .side {
    max-block-size: none;
    overflow: visible;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    border-radius: 0;
  }
  .side::after {
    display: none;
  }
  .side-toggle {
    display: flex;
  }
  .side-body {
    display: none;
  }
  .side.open .side-body {
    display: block;
    margin-block-start: 8px;
    padding: 12px;
    border-radius: 14px;
    background: var(--pack-panel);
    border: 1px solid var(--pack-line);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .side-toggle svg {
    transition: transform 0.2s;
  }
}

/* Forced colours: the panel and the toggle keep a system border, the current link a system edge. */
@media (forced-colors: active) {
  .glow::after {
    display: none;
  }
  .glow,
  .side-toggle {
    border: 1px solid CanvasText;
  }
  [part~="link"][aria-current="page"] {
    forced-color-adjust: none;
    color: HighlightText;
    background: Highlight;
    box-shadow: none;
  }
}
