/* Version switcher (see /shared/switch.js). Each version tunes the look with the
   --vs-* custom properties and a few rules in its own style.css. */

/* Defaults with zero specificity: a version overrides any of them in its own :root rule. */
:where(:root) {
  --vs-ink: #1e2233;
  --vs-paper: #ffffff;
  --vs-muted: #565f75;
  --vs-accent: #1f4fbf;
  --vs-here-bg: #ffc93c;
  --vs-here-ink: #1e2233;
  --vs-hover: #eef4fa;
  --vs-font: Arial, Helvetica, sans-serif;
  --vs-name-font: var(--vs-font);
  --vs-btn-font: var(--vs-font);
  --vs-btn-bg: var(--vs-paper);
  --vs-btn-ink: var(--vs-ink);
  --vs-btn-border: var(--vs-ink);
  --vs-radius: 6px;
  --vs-border: 2px;
  --vs-shadow: 3px 3px 0 var(--vs-ink);
  --vs-btn-shadow: var(--vs-shadow);
}

.vs {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  font: 15px/1.3 var(--vs-font);
  color: var(--vs-ink);
  text-align: left;
}

.vs-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 6px 10px;
  font: 15px/1.2 var(--vs-btn-font);
  color: var(--vs-btn-ink);
  background: var(--vs-btn-bg);
  border: var(--vs-border) solid var(--vs-btn-border);
  border-radius: var(--vs-radius);
  box-shadow: var(--vs-btn-shadow);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.vs-btn:focus-visible { outline: 3px solid var(--vs-accent); outline-offset: 2px; }
.vs-icon { width: 16px; height: 16px; flex: none; }
.vs-icon path { stroke: currentColor; stroke-width: 1.4; }
.vs-i1 { fill: #ffc93c; }
.vs-i2 { fill: #ee6a4b; }
.vs-i3 { fill: #f6efdf; }
.vs-short { display: none; }

.vs-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1000;
  width: 300px;
  max-width: calc(100vw - 16px);
  padding: 12px;
  color: var(--vs-ink);
  background: var(--vs-paper);
  border: var(--vs-border) solid var(--vs-ink);
  border-radius: var(--vs-radius);
  box-shadow: var(--vs-shadow), 0 10px 30px rgba(0, 0, 0, 0.18);
}
.vs-panel[hidden] { display: none; }

.vs-title {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--vs-muted);
}

.vs-list { margin: 0; padding: 0; list-style: none; }
.vs-list li { margin: 0; padding: 0; }
.vs-list li + li { margin-top: 4px; }

.vs-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  align-items: baseline;
  padding: 8px 9px;
  color: var(--vs-ink);
  text-decoration: none;
  border-radius: calc(var(--vs-radius) * 0.6);
  border: 1px solid transparent;
}
.vs-item:hover,
.vs-item:focus-visible { background: var(--vs-hover); border-color: var(--vs-ink); outline: none; }
.vs-item:focus-visible { box-shadow: 0 0 0 2px var(--vs-accent); }
.vs-name { font: 700 15px/1.25 var(--vs-name-font); grid-column: 1; }
.vs-here {
  grid-column: 2;
  justify-self: end;
  padding: 2px 6px;
  font: 700 11px/1.3 var(--vs-font);
  color: var(--vs-here-ink);
  background: var(--vs-here-bg);
  border-radius: 3px;
  white-space: nowrap;
}
.vs-line { grid-column: 1 / -1; font-size: 13.5px; line-height: 1.35; color: var(--vs-muted); }
.vs-item.is-current { cursor: default; }

.vs-home {
  display: block;
  margin-top: 8px;
  padding: 8px 9px 2px;
  border-top: 1px solid var(--vs-ink);
  font-size: 14px;
  color: var(--vs-accent);
  text-underline-offset: 3px;
}
.vs-home:focus-visible { outline: 3px solid var(--vs-accent); outline-offset: 1px; }

/* No slot on the page (the 404 pages): a fixed corner. */
.vs-fixed {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1000;
}

@media (prefers-reduced-motion: no-preference) {
  .vs-panel { animation: vs-pop 0.14s ease-out; }
  @keyframes vs-pop { from { opacity: 0; transform: translateY(-4px); } }
}

@media print { .vs, [data-vs-slot] { display: none !important; } }
