/* Interactive demos for the SVG article. Scoped to .svgd so nothing leaks into the prose. */
.svgd {
  margin: 1.5rem 0;
  padding: 1.25rem;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--ink);
  font-family: var(--font-body);
}

.svgd__title {
  margin: 0 0 1rem;
  font-family: var(--font-label);
  font-size: var(--fs-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.svgd__row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.svgd__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  margin-top: 1rem;
  font-size: var(--fs-small);
  color: var(--muted);
}

.svgd__controls label {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.svgd input[type="range"] {
  accent-color: var(--accent);
}

.svgd input[type="color"] {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: none;
  cursor: pointer;
}

/* Same look as the site's small label buttons; the label sits 1.5px lower
   because Fira Sans Condensed caps ride high in the line box. */
.svgd button {
  padding: calc(0.4rem + 1.5px) 0.75rem calc(0.4rem - 1.5px);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-label);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
  cursor: pointer;
}

.svgd button:hover,
.svgd button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent-ink);
}

.svgd__note {
  margin: 1rem 0 0;
  font-size: var(--fs-small);
  color: var(--muted);
}

.svgd__note strong {
  color: var(--ink);
}

/* 1. Sprite */
.svgd-sprite {
  --icon-size: 40px;
  --icon-color: #ff6a2b;
  color: var(--icon-color);
}

.svgd-sprite .svgd__icon {
  display: grid;
  place-items: center;
  width: calc(var(--icon-size) + 24px);
  height: calc(var(--icon-size) + 24px);
  border: 1px solid var(--line);
}

.svgd-sprite svg {
  width: var(--icon-size);
  height: var(--icon-size);
}

/* 2. Optimisation */
.svgd-opt {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.svgd-opt__pane {
  min-width: 0;
}

.svgd-opt__preview {
  display: grid;
  place-items: center;
  height: 96px;
  margin-bottom: 0.5rem;
  border: 1px dashed var(--line-strong);
  color: var(--accent);
}

.svgd-opt__preview svg {
  width: 64px;
  height: 64px;
}

.svgd pre.svgd__code {
  max-height: 220px;
  margin: 0;
  padding: 0.75rem;
  overflow: auto;
  background: var(--bg-sunken);
  color: var(--ink);
  font-family: var(--font-code);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

.svgd__size {
  display: block;
  margin-top: 0.5rem;
  font-size: var(--fs-small);
  color: var(--muted);
}

/* 3. currentColor */
.svgd-color__card {
  display: grid;
  gap: 0.5rem;
  justify-items: center;
  min-width: 140px;
  padding: 1rem;
  border: 1px solid var(--line);
  font-size: var(--fs-small);
  color: var(--muted);
  text-align: center;
}

.svgd-color__icons svg {
  width: 56px;
  height: 56px;
  color: var(--svgd-color, #ff6a2b);
  transition: color 0.2s;
}

/* 4. Encoder */
.svgd textarea {
  width: 100%;
  min-height: 120px;
  padding: 0.75rem;
  border: 1px solid var(--line-strong);
  background: var(--bg-sunken);
  color: var(--ink);
  font-family: var(--font-code);
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
}

.svgd-enc__out {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.svgd-enc__bg {
  height: 64px;
  margin-bottom: 0.5rem;
  border: 1px dashed var(--line-strong);
  background-color: var(--bg);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 40px 40px;
}

/* 5. Decision helper */
.svgd-pick__q {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: var(--fs-small);
}

.svgd-pick__q span {
  min-width: 15rem;
  color: var(--ink);
}

.svgd-pick__answer {
  margin-top: 1rem;
  padding: 1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
}

.svgd-pick__answer b {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--accent-ink);
}
