/* Vormgenerator — alles gescoped achter .vg */

.vg {
  --vg-panel: var(--white-overlay);
  --vg-paper-2: var(--grey-overlay);
  --vg-ink: var(--text);
  --vg-ink-soft: color-mix(in oklch, var(--text) 80%, var(--background));
  --vg-ink-faint: color-mix(in oklch, var(--text) 55%, var(--background));
  --vg-line: color-mix(in oklch, var(--text) 16%, var(--background));
  --vg-line-soft: color-mix(in oklch, var(--text) 9%, var(--background));
  --vg-ui: 'Rubik', sans-serif;
  --vg-read: 'Crimson Text', serif;
  max-width: 1200px;
  margin: 0 auto 2rem;
  font-family: var(--vg-ui);
  color: var(--vg-ink);
}
[data-theme="dark"] .vg {
  --vg-line: color-mix(in oklch, var(--text) 28%, var(--background));
  --vg-line-soft: color-mix(in oklch, var(--text) 14%, var(--background));
}
.vg *, .vg *::before, .vg *::after { box-sizing: border-box; }
.vg p { margin: 0; }
.vg h2 { font-size: 0.85rem; font-weight: 600; letter-spacing: 0.01em; margin: 0; }

.vg-intro { padding: 2.2rem 0 1.2rem; }
.vg-kicker { font-size: 0.55rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--main-color); }
.vg-title-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0.2rem 0 0.6rem; }
.vg-title-row h1 { margin: 0; }

.vg-help {
  flex: none; width: 0.95rem; height: 0.95rem; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--vg-ui); font-size: 0.52rem; font-weight: 600; line-height: 1; padding: 0; cursor: pointer;
  color: var(--vg-ink); background: var(--vg-panel); border: 1.5px solid var(--vg-ink); border-radius: 5px;
  box-shadow: var(--shadow-subtle); transition: background-color .15s, color .15s;
}
.vg-help:hover { background: var(--vg-ink); color: var(--background); }

.vg button:focus-visible, .vg input:focus-visible, .vg select:focus-visible { outline: 2px solid var(--main-color); outline-offset: 2px; }

/* Indeling */
.vg-grid { display: grid; grid-template-columns: minmax(16rem, 0.8fr) 1.2fr; gap: 0.9rem; align-items: start; }

.vg-panel { background: var(--vg-panel); border-radius: 12px; box-shadow: var(--shadow-subtle); padding: 0.8rem 0.9rem 0.9rem; }

/* Knoppen */
.vg-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: var(--vg-ui); font-size: 0.55rem; line-height: 1.4; padding: 0.25rem 0.65rem; border-radius: 7px;
  border: 1px solid var(--vg-line); background: var(--vg-panel); color: var(--vg-ink-soft); cursor: pointer; white-space: nowrap;
}
.vg-btn:hover:not(:disabled) { border-color: var(--vg-ink-faint); color: var(--vg-ink); }
.vg-btn:disabled { opacity: 0.4; cursor: default; }
.vg-btn.is-done { color: var(--main-color); border-color: var(--main-color); }
.vg-btn--primary { background: var(--vg-ink); color: var(--background); border-color: var(--vg-ink); }
.vg-btn--primary:hover:not(:disabled) { color: var(--background); border-color: var(--vg-ink); opacity: 0.88; }
.vg-btn svg { flex: none; }
.vg-btn--icon { width: 1.3rem; height: 1.3rem; padding: 0; justify-content: center; }

/* Vormkeuze */
.vg-shapes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.vg-shape {
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  padding: 0.5rem 0.3rem 0.4rem; border-radius: 8px; cursor: pointer;
  font-family: var(--vg-ui); font-size: 0.52rem; color: var(--vg-ink-soft);
  background: var(--background); border: 1px solid var(--vg-line-soft);
  transition: border-color .15s, color .15s;
}
.vg-shape svg { width: 1.6rem; height: 1.6rem; display: block; }
.vg-shape:hover { border-color: var(--vg-ink-faint); color: var(--vg-ink); }
.vg-shape[aria-checked="true"] { border-color: var(--vg-ink); color: var(--vg-ink); box-shadow: inset 0 0 0 0.5px var(--vg-ink); }

/* Groepen met instellingen */
.vg-group { margin-top: 1rem; padding-top: 0.8rem; border-top: 1px solid var(--vg-line-soft); }
[data-theme="dark"] .vg-group { border-top-color: var(--vg-line); }
.vg-group-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.6rem; }
.vg-params { display: flex; flex-direction: column; gap: 0.7rem; }
.vg-param-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.15rem; }
.vg-param label { font-size: 0.6rem; color: var(--vg-ink); }
.vg-param output { font-size: 0.55rem; color: var(--vg-ink-faint); font-variant-numeric: tabular-nums; }
.vg-param[hidden], .vg-toggle[hidden] { display: none; }

/* Keuzerij (segmenten) */
.vg-seg { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.vg-seg .vg-btn[aria-checked="true"] { color: var(--vg-ink); border-color: var(--vg-ink); }

/* Schuif */
.vg input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 1rem; margin: 0; background: transparent; cursor: pointer;
}
.vg input[type="range"]::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px;
  background: linear-gradient(var(--vg-ink), var(--vg-ink)) 0 / var(--vg-fill, 50%) 100% no-repeat, var(--vg-line);
}
.vg input[type="range"]::-moz-range-track { height: 3px; border-radius: 2px; background: var(--vg-line); }
.vg input[type="range"]::-moz-range-progress { height: 3px; border-radius: 2px; background: var(--vg-ink); }
.vg input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 12px; height: 12px; margin-top: -4.5px;
  border-radius: 4px; border: 1.5px solid var(--vg-ink); background: var(--vg-panel);
}
.vg input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 4px; border: 1.5px solid var(--vg-ink); background: var(--vg-panel); box-sizing: border-box;
}
.vg input[type="range"]:focus-visible { outline: none; }
.vg input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--main-color); outline-offset: 2px; }
.vg input[type="range"]:focus-visible::-moz-range-thumb { outline: 2px solid var(--main-color); outline-offset: 2px; }

/* Kleuren */
.vg-swatches { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.8rem; }
.vg-swatch {
  position: relative; width: 1.1rem; height: 1.1rem; padding: 0; border-radius: 5px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--vg-sw) 70%, #000); background: var(--vg-sw);
}
.vg-swatch[aria-checked="true"] { outline: 1.5px solid var(--vg-ink); outline-offset: 2px; }
.vg-swatch--custom {
  overflow: hidden;
  background: conic-gradient(from 90deg, #c84f4f, #f9e07f, #43978d, #4a75a3, #5b3c55, #c84f4f);
  border-color: var(--vg-line);
}
.vg-swatch--custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.vg-swatch--custom:has(input:focus-visible) { outline: 2px solid var(--main-color); outline-offset: 2px; }

/* Voorbeeld */
.vg-stage { display: flex; flex-direction: column; gap: 0.7rem; }
.vg-canvas {
  aspect-ratio: 1 / 1; width: 100%; max-height: 70vh; margin: 0 auto; border-radius: 8px;
  background: var(--background); border: 1px solid var(--vg-line-soft);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.vg-canvas svg { width: 100%; height: 100%; display: block; }
.vg-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.4rem; }

/* Vinkjes (huisstijl) */
.vg-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 0.6rem; color: var(--vg-ink); cursor: pointer; user-select: none; }
.vg-toggle input { appearance: none; -webkit-appearance: none; box-sizing: border-box; position: relative; width: 14px; height: 14px; margin: 0 3px 0 0; flex: none; cursor: pointer; border: 1.5px solid var(--text); border-radius: 1px; background-color: var(--white-overlay); }
.vg-toggle input:checked { border: 0; }
.vg-toggle input:checked::after {
  content: ""; position: absolute; left: 0; top: -1.27px; width: 16.9px; height: 15.25px; background-color: var(--main-color);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='33.3 28 85.5 77.1'%3E%3Cpath d='M85.9 37.9H36.8V101.6H100.6V54' fill='none' stroke='%23000' stroke-width='7'/%3E%3Cpath d='M50.35 51.34a7.13 7.13 0 0 0-3.62 7.18c.83 3.18 7.59 4.03 15.36 17.88l4.2 8.3a7.14 7.14 0 0 0 12.25 .36l4.42-9.58c13.44-26.59 29.5-34.45 30.37-36.12 2.48-4.76-4.1-10.97-11.42-8.77-2.01.61-14.17 8.66-28.3 31.6l-1.57 2.55-2.16-3.07C61.7 51.31 56.65 47.34 50.35 51.34Z'/%3E%3C/svg%3E") left top / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='33.3 28 85.5 77.1'%3E%3Cpath d='M85.9 37.9H36.8V101.6H100.6V54' fill='none' stroke='%23000' stroke-width='7'/%3E%3Cpath d='M50.35 51.34a7.13 7.13 0 0 0-3.62 7.18c.83 3.18 7.59 4.03 15.36 17.88l4.2 8.3a7.14 7.14 0 0 0 12.25 .36l4.42-9.58c13.44-26.59 29.5-34.45 30.37-36.12 2.48-4.76-4.1-10.97-11.42-8.77-2.01.61-14.17 8.66-28.3 31.6l-1.57 2.55-2.16-3.07C61.7 51.31 56.65 47.34 50.35 51.34Z'/%3E%3C/svg%3E") left top / 100% 100% no-repeat;
}
.vg-toggle input:not(:checked) + span { opacity: .5; text-decoration: line-through; }
.vg-toggle:has(input:focus-visible) span { outline: 2px solid var(--main-color); outline-offset: 2px; border-radius: 2px; }

/* Uitlegvenster */
.vg-dialog { width: min(44rem, calc(100vw - 2rem)); max-height: calc(100dvh - 4rem); padding: 0; border: none; border-radius: 12px; background: var(--vg-panel); color: var(--vg-ink); box-shadow: var(--shadow-hard); overflow: auto; }
.vg-dialog::backdrop { background: rgba(0,0,0,0.35); }
.vg-dialog-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 2.2rem 2.6rem 0.8rem; background: var(--vg-panel); border-bottom: 1px solid var(--vg-line-soft); }
.vg-dialog-close { width: 1.4rem; height: 1.4rem; display: inline-flex; align-items: center; justify-content: center; font-size: 0.9rem; line-height: 1; padding: 0; color: var(--vg-ink-soft); background: var(--vg-panel); border: 1px solid var(--vg-line); border-radius: 7px; cursor: pointer; }
.vg-dialog-close:hover { color: var(--vg-ink); border-color: var(--vg-ink-faint); }
.vg-how { padding: 0.4rem 2.6rem 2.4rem; }
.vg-how p, .vg-how li { font-family: var(--vg-read); font-size: 0.8rem; line-height: 1.5; color: var(--vg-ink-soft); }
.vg-how p { margin-top: 0.6rem !important; }
.vg-how .vg-how-lead { color: var(--vg-ink); }
.vg-how .vg-how-privacy { display: flex; align-items: flex-start; gap: 0.45rem; margin-top: 0.8rem !important; padding: 0.5rem 0.7rem; border-radius: 8px; background: var(--vg-paper-2); font-family: var(--vg-ui); font-size: 0.6rem; line-height: 1.45; color: var(--vg-ink-soft); }
.vg-how-privacy svg { flex: none; margin-top: 0.12rem; }
.vg-how h3 { font-family: var(--vg-ui); font-size: 0.68rem; font-weight: 600; margin: 1.1rem 0 0; }
.vg-how ul { padding-left: 1.1rem; margin: 0.6rem 0 0; }
.vg-how li { list-style: circle; margin-bottom: 0.35rem; }
.vg-how b { font-weight: 600; color: var(--vg-ink); }

@media (max-width: 980px) {
  .vg h2 { font-size: 1rem; }
  .vg-kicker { font-size: 0.7rem; }
  .vg-btn, .vg-toggle, .vg-param label { font-size: 0.8rem; }
  .vg-btn--icon { width: 2rem; height: 2rem; }
  .vg-btn--icon svg { width: 13px; height: 13px; }
  .vg-param output { font-size: 0.75rem; }
  .vg-shape { font-size: 0.72rem; }
  .vg-shape svg { width: 2rem; height: 2rem; }
  .vg-swatch { width: 1.6rem; height: 1.6rem; }
  .vg input[type="range"] { height: 1.4rem; }
  .vg-how p, .vg-how li { font-size: 1rem; }
  .vg-how .vg-how-privacy { font-size: 0.8rem; }
  .vg-how h3 { font-size: 0.9rem; }
  .vg-help { width: 1.3rem; height: 1.3rem; font-size: 0.75rem; }
  .vg-dialog-close { width: 1.9rem; height: 1.9rem; font-size: 1.2rem; }
}
@media (max-width: 760px) {
  .vg-grid { grid-template-columns: 1fr; }
  .vg-stage { order: -1; }
  .vg-actions { justify-content: stretch; }
  .vg-actions .vg-btn { flex: 1; justify-content: center; }
  .vg-dialog-head { padding: 1.4rem 1.4rem 0.7rem; }
  .vg-how { padding: 0.3rem 1.4rem 1.6rem; }
}
@media (prefers-reduced-motion: reduce) { .vg * { transition: none !important; animation: none !important; } }
