/* Free takeoff demo. Styles only descendants of #demo-root and uses only the page's tokens. */

#demo-root {
  font-family: var(--font-body);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 44px;
  min-width: 0;
}
#demo-root *, #demo-root *::before, #demo-root *::after { box-sizing: border-box; }
#demo-root [hidden] { display: none !important; }

#demo-root .demo-step { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

#demo-root .demo-step-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  text-wrap: balance;
}
#demo-root .demo-step-num {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  width: 1.9em;
  height: 1.9em;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--bg);
  background: var(--ink);
}

#demo-root p { margin: 0; }
#demo-root .demo-help,
#demo-root .demo-status,
#demo-root .demo-quota { font-size: 0.95rem; line-height: 1.5; color: var(--muted); max-width: 68ch; }
#demo-root .demo-status { color: var(--ink); font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.6; }

#demo-root .demo-error {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink);
  background: color-mix(in srgb, var(--bad) 12%, var(--surface));
  border-left: 4px solid var(--bad);
  border-radius: var(--radius);
  padding: 12px 14px;
  max-width: 68ch;
}

/* Drop zone: the dashed edge marks where a file can be dropped */
#demo-root .demo-drop {
  border: 2px dashed var(--line);
  border-radius: calc(var(--radius) * 3);
  background: transparent;
  padding: 22px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
}
#demo-root .demo-drop-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
#demo-root .demo-drop-title { font-weight: 700; font-size: 1.05rem; color: var(--ink); }

#demo-root .demo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }

/* Buttons */
#demo-root .demo-btn {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 11px 16px;
  border-radius: var(--radius);
  border: 0;
  background: color-mix(in srgb, var(--ink) 9%, transparent);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
#demo-root .demo-btn:hover { background: color-mix(in srgb, var(--ink) 16%, transparent); }
#demo-root .demo-btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
#demo-root .demo-btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
#demo-root .demo-btn[aria-pressed="true"] { background: transparent; box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); cursor: default; }

#demo-root .demo-btn:focus-visible,
#demo-root .demo-link:focus-visible,
#demo-root .demo-table-wrap:focus-visible,
#demo-root textarea:focus-visible,
#demo-root .demo-visually-hidden:focus-visible + .demo-btn {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

#demo-root .demo-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

#demo-root .demo-link { color: var(--accent); font-weight: 700; font-size: 0.95rem; text-underline-offset: 3px; }

/* Demo choices */
#demo-root .demo-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
#demo-root .demo-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 20px;
  background: var(--surface);
  border-radius: calc(var(--radius) * 3);
}
#demo-root .demo-card-active { box-shadow: inset 0 0 0 2px var(--accent); }
#demo-root .demo-card-locked { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
#demo-root .demo-card-locked .demo-card-title,
#demo-root .demo-card-locked .demo-card-blurb { color: var(--muted); }
#demo-root .demo-card-title { font-family: var(--font-display); font-size: 1.12rem; font-weight: 700; line-height: 1.25; margin: 0; text-wrap: balance; }
#demo-root .demo-card-blurb { font-size: 0.93rem; line-height: 1.45; color: var(--muted); flex: 1; }
#demo-root .demo-card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }

#demo-root .demo-pill {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--muted);
  white-space: nowrap;
}
#demo-root .demo-pill-open { color: var(--good); }
#demo-root .demo-pill-free { color: var(--accent); }
#demo-root .demo-pill-locked { color: var(--muted); }

/* Results: open on the page, no panel */
#demo-root .demo-results {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
#demo-root .demo-result-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; }
#demo-root .demo-result-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; line-height: 1.25; margin: 0; }
#demo-root .demo-result-file { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
#demo-root .demo-copy-status { font-size: 0.85rem; color: var(--muted); }

#demo-root .demo-summary {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  line-height: 1.3;
  font-weight: 700;
  max-width: 34em;
  text-wrap: balance;
  padding-top: 16px;
  background: linear-gradient(var(--accent), var(--accent)) left top / 56px 4px no-repeat;
}
#demo-root .demo-summary-good {
  background-image: linear-gradient(var(--good), var(--good));
}
#demo-root .demo-empty { color: var(--muted); font-size: 1rem; line-height: 1.5; padding: 4px 0; }

#demo-root .demo-table-block { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
#demo-root .demo-table-title {
  font-family: var(--font-body);
  font-size: 0.93rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
#demo-root .demo-flag-warn .demo-table-title { color: var(--warn); }
#demo-root .demo-flag-warn .demo-table-wrap { box-shadow: inset 4px 0 0 var(--warn); }

#demo-root .demo-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  border-radius: calc(var(--radius) * 2);
  background: var(--surface);
}
#demo-root .demo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}
#demo-root .demo-table th,
#demo-root .demo-table td {
  padding: 10px 16px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
#demo-root .demo-table th {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  border-bottom-color: var(--ink);
}
#demo-root .demo-table td:first-child { font-family: var(--font-mono); font-size: 0.82rem; }
#demo-root .demo-table tbody tr:last-child td { border-bottom: 0; }
#demo-root .demo-table tfoot td { font-weight: 700; border-top: 1px solid var(--ink); border-bottom: 0; }
#demo-root .demo-table .demo-num { text-align: right; font-family: var(--font-mono); font-size: 0.82rem; }

#demo-root .demo-notes {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 68ch;
}

/* Pay item list */
#demo-root .demo-payitems-block { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
#demo-root .demo-label { font-size: 0.93rem; font-weight: 700; }
#demo-root .demo-payitems,
#demo-root .demo-copy-text {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 12px 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  resize: vertical;
  white-space: pre;
  overflow-x: auto;
}

@media (max-width: 480px) {
  #demo-root { gap: 34px; }
  #demo-root .demo-drop { padding: 16px; }
  #demo-root .demo-cards { grid-template-columns: 1fr; }
  #demo-root .demo-actions .demo-btn { flex: 1 1 auto; justify-content: center; }
}

@media (prefers-reduced-motion: no-preference) {
  #demo-root .demo-btn, #demo-root .demo-card, #demo-root .demo-drop { transition: background-color 120ms ease, box-shadow 120ms ease, border-color 120ms ease; }
}
