/* Interactive folding demo (projects/origami.html): a curve picker, then one GIF-style canvas per design
   (drawn by fold-demo.js in the style of the folding GIFs), then playback controls. */
.fold-demo { margin: 22px 0 8px; display: grid; gap: 14px; }

/* picker: one card per target curve, with the curve itself as the label */
.fd-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.fd-pick {
  display: grid; justify-items: center; gap: 4px; padding: 10px 8px; min-width: 0;
  font: inherit; color: var(--text); text-align: center; cursor: pointer;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 10px;
}
.fd-pick:hover { border-color: var(--muted); }
.fd-pick svg { width: 56px; height: 56px; display: block; }
.fd-pick svg path { fill: none; stroke: var(--muted); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 7 5; }
.fd-pick-name { font-size: 0.88rem; font-weight: 600; line-height: 1.25; }
.fd-pick[aria-selected="true"] { border-color: var(--accent); background: var(--badge-bg); }
.fd-pick[aria-selected="true"] svg path { stroke: var(--text); }
.fd-pick:focus-visible, .fd-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 680px) {
  .fd-picker { display: flex; overflow-x: auto; gap: 8px; padding-bottom: 4px; }
  .fd-pick { flex: 0 0 104px; }
}

/* one white frame per design, like the GIFs, two side by side */
.fd-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 680px) { .fd-cards { grid-template-columns: minmax(0, 1fr); } }
.fd-card { background: #fff; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.fd-card canvas { display: block; width: 100%; aspect-ratio: 4 / 3; max-width: 100%; touch-action: pan-y; }

.fd-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.fd-btn {
  font: inherit; font-size: 0.88rem; padding: 4px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--card); color: var(--text); min-width: 72px;
}
.fd-btn:hover { border-color: var(--accent); }
.fd-scrub { flex: 1 1 240px; display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 0.85rem; color: var(--muted); }
.fd-scrub input { flex: 1; min-width: 0; accent-color: #F28C28; }
.fd-status:empty { display: none; }

/* growth demo (grow-demo.js): one GIF-style frame, token buttons under it */
.grow-demo { margin: 22px 0 8px; display: grid; gap: 14px; }
.gd-picker { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; }
@media (max-width: 680px) {
  .gd-picker { display: flex; overflow-x: auto; gap: 8px; padding-bottom: 4px; }
  .gd-picker .fd-pick { flex: 0 0 104px; }
}
.gd-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 680px) { .gd-cards { grid-template-columns: minmax(0, 1fr); } }
.gd-card { background: #fff; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.gd-card canvas { display: block; width: 100%; aspect-ratio: 4 / 3; max-width: 100%; }
.gd-steps { display: flex; flex-wrap: wrap; gap: 8px; }
.gd-steps .fd-btn[aria-pressed="true"] { border-color: #F28C28; background: #FFF1E3; color: #1F2933; }

/* scale / rotation slider (sweep-demo.js): picker, two GIF-style frames (ours | nearest), slider, error chart */
.sweep-demo { margin: 22px 0 8px; display: grid; gap: 14px; --sd-ours: #D9731A; --sd-nn: #3B76B8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sweep-demo { --sd-ours: #D26F17; --sd-nn: #5C93D1; } }
:root[data-theme="dark"] .sweep-demo { --sd-ours: #D26F17; --sd-nn: #5C93D1; }
.sd-picker { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.sd-pick-range { font-size: 0.78rem; color: var(--muted); line-height: 1.2; }
@media (max-width: 680px) { .sd-picker .fd-pick { flex: 0 0 112px; } }
.sd-cap { margin: 0; padding: 7px 12px; display: flex; align-items: center; gap: 8px; font-size: 0.9rem; font-weight: 600;
  color: #1F2933; border-bottom: 1px solid #E4E6EA; }
.sd-sw { display: inline-block; width: 14px; height: 4px; border-radius: 2px; background: var(--sd-ours); flex: none; }
.sd-sw.sd-nn, .sd-card.sd-nn .sd-cap .sd-sw { background: var(--sd-nn); }
.sd-lab-name { font-weight: 600; color: var(--text); min-width: 4.6em; }
.sd-val { min-width: 8em; color: var(--text); font-variant-numeric: tabular-nums; }
.sd-value input, .sd-fold input { accent-color: #F28C28; }
.sd-chart { margin: 0; display: grid; gap: 6px; }
.sd-chart svg { width: 100%; height: auto; display: block; touch-action: pan-y; cursor: crosshair; }
.sd-hit { fill: transparent; }
.sd-grid { stroke: var(--rule); stroke-width: 1; }
.sd-tick { fill: var(--muted); font-size: 11px; }
.sd-now { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.sd-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sd-line.sd-ours { stroke: var(--sd-ours); } .sd-line.sd-nn { stroke: var(--sd-nn); }
.sd-dot { stroke: var(--bg); stroke-width: 2; pointer-events: none; }
.sd-dot.sd-ours { fill: var(--sd-ours); } .sd-dot.sd-nn { fill: var(--sd-nn); }
.sd-lab { fill: var(--text); font-size: 12px; font-weight: 600; }
.sd-tip { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.86rem; color: var(--text); font-variant-numeric: tabular-nums; }
.sd-tip span { display: inline-flex; align-items: center; gap: 6px; }

/* ETH benchmark: the same viewer with one design per curve and a nine-curve picker */
.fd-single .fd-cards { grid-template-columns: minmax(0, 1fr); max-width: 760px; width: 100%; justify-self: center; }
.eth-split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 8px 28px; align-items: start; }
@media (max-width: 860px) { .eth-split { grid-template-columns: minmax(0, 1fr); } }
/* the picker spans both columns above them, so the folding and the table start level */
.eth-split .fold-demo { margin: 0; }
.eth-side { min-width: 0; display: grid; gap: 4px; }
.eth-side .tablewrap { margin-top: 0; }
.eth-side table { width: 100%; }
.eth-side tr.fd-row-on th, .eth-side tr.fd-row-on td { background: var(--badge-bg); transition: background 0.3s; }
.eth-side tr.fd-row-on th:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.eth-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 22px 0 14px; }
.eth-picker .fd-pick { padding: 8px 4px; }
.eth-picker .fd-pick svg { width: 44px; height: 44px; }
.eth-picker .fd-pick-name { font-size: 0.8rem; }
@media (max-width: 680px) { .eth-picker .fd-pick { flex: 0 0 88px; } }
td.win { font-weight: 650; }
.eth-compare { margin: 18px 0 8px; }
.eth-compare img { display: block; width: 100%; height: auto; background: #fff; border: 1px solid var(--rule); border-radius: 10px; }
