/* AltSql Ask live demo, v1: embedded in altsql.com/demo/ask/ or opened full screen at /demo/ask/app/ */
:root {
  --navy: #1F3A5F;
  --navy-2: #2A4B75;
  --teal: #0E7C86;
  --teal-2: #0A646C;
  --teal-light: #E6F3F4;
  --ink: #262626;
  --gray: #5F6B7A;
  --gray-2: #8A95A3;
  --rule: #D5DDE5;
  --zebra: #F4F7F9;
  --off: #EEF1F4;
  --bg: #F7F9FB;
  --card: #FFFFFF;
  --amber: #B8700F;
  --amber-light: #FBF1E1;
  --red: #C0392B;
  --red-light: #FBEAE8;
  --green: #2E7D4F;
  --green-light: #E7F4EC;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: var(--teal); }
button, select, input, textarea { font: inherit; }
code { font-family: var(--mono); font-size: .92em; background: var(--zebra); border: 1px solid var(--off); border-radius: 5px; padding: 0 4px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ---- app bar (full screen only) ---- */
.appbar { background: #000; color: #fff; }
.appbar .wrap { display: flex; align-items: center; gap: 14px; min-height: 56px; }
.brand { color: rgba(255,255,255,.9); font-family: "avenir next", avenir, sans-serif; font-weight: 200; font-size: 24px; text-decoration: none; }
.brand:hover { color: #fff; }
.appbar .tag { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; background: rgba(255,255,255,.14); padding: 3px 9px; border-radius: 999px; }
.appbar .grow { flex: 1; }
.appbar .home { color: rgba(255,255,255,.85); font-size: 15px; text-decoration: none; }
.appbar .home:hover { color: #fff; text-decoration: underline; }

.embedded .appbar { display: none; }
.embedded body { background: transparent; }
.embedded .wrap { padding-left: 0; padding-right: 0; }
.embedded .intro { display: none; }

/* ---- intro ---- */
.intro { padding: 18px 0 2px; }
.eyebrow { color: var(--teal); font-weight: 700; font-size: 12.5px; letter-spacing: 1.4px; text-transform: uppercase; margin: 0 0 6px; }
h1 { color: var(--navy); font-size: 28px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.3px; }
.lead { font-size: 16.5px; color: #333; max-width: 900px; margin: 0 0 10px; }
.honest { display: inline-block; background: var(--teal-light); border: 1px solid #b9dde0; color: var(--teal-2); border-radius: 10px; padding: 6px 12px; font-size: 14px; margin: 0; }
.honest b { color: var(--navy); }

/* ---- panels ---- */
.panel { margin: 16px 0 0; background: #fff; border: 1px solid var(--rule); border-radius: 14px; padding: 18px 20px 20px; }
.panel h2 { color: var(--navy); font-size: 22px; margin: 0 0 6px; }
.panel h3 { color: var(--navy); font-size: 16px; margin: 16px 0 6px; }
.panel p { margin: 6px 0; max-width: 920px; }
.panel-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.panel-head h2 { margin-bottom: 0; }
.muted { color: var(--gray); font-size: 14.5px; }
.small { font-size: 13.5px; }
.note { background: var(--amber-light); color: #6b4308; border-radius: 10px; padding: 8px 12px; font-size: 14.5px; }
.note.good { background: var(--green-light); color: #1f5e3a; }
.note.bad { background: var(--red-light); color: var(--red); }
.err { background: var(--red-light); color: var(--red); border-radius: 10px; padding: 8px 12px; font-weight: 600; font-size: 14.5px; }
.noscript { background: var(--red-light); color: var(--red); border-radius: 10px; padding: 12px 14px; margin: 16px 0; font-weight: 600; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 10px;
  border: 1px solid var(--rule); background: #fff; color: var(--navy);
  font-weight: 650; font-size: 15.5px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.btn:hover { border-color: var(--gray-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .preset:focus-visible, .break:focus-visible { outline: 3px solid rgba(14,124,134,.35); outline-offset: 2px; }
.btn[disabled] { opacity: .45; cursor: default; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-2); border-color: var(--teal-2); }

/* ---- progress ---- */
.load, .progress { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; }
.bar { flex: 1; height: 8px; background: var(--off); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--teal); border-radius: 99px; transition: width .15s linear; }
.load span, .progress .pct { font-variant-numeric: tabular-nums; color: var(--gray); font-size: 14px; min-width: 12em; text-align: right; }

/* ---- the fleet ---- */
.plants { display: flex; flex-wrap: wrap; gap: 14px 18px; margin-top: 12px; }
.plant h4 { margin: 0 0 5px; font-size: 13.5px; color: var(--navy); font-weight: 650; }
.plant h4 small { color: var(--gray); font-weight: 500; }
.dots { display: grid; grid-template-columns: repeat(10, 12px); grid-auto-rows: 12px; gap: 4px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #D9E0E7; border: 2px solid transparent; transition: background .2s, border-color .2s; }
.dot.weak { border: 2px dashed var(--gray-2); background: #EDF1F5; }
.dot.asked { background: #fff; border: 2px solid var(--navy); }
.dot.done { background: var(--teal); border-color: var(--teal); }
.dot.part { background: var(--amber); border-color: var(--amber); }
.dot.refused { background: var(--red); border-color: var(--red); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--gray); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 11px; height: 11px; }

/* ---- asking ---- */
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.preset { border: 1px solid var(--rule); background: var(--zebra); color: var(--navy); border-radius: 99px; padding: 6px 12px; font-size: 14px; cursor: pointer; text-align: left; }
.preset:hover { border-color: var(--teal); background: var(--teal-light); }
.preset.on { background: var(--navy); border-color: var(--navy); color: #fff; }
textarea#sql {
  display: block; width: 100%; min-height: 64px; height: 84px; resize: vertical; border: 1px solid var(--rule); border-radius: 10px;
  padding: 10px 12px; font-family: var(--mono); font-size: 14px; color: var(--ink); background: #fff;
}
textarea#sql:focus, select:focus { outline: 3px solid rgba(14,124,134,.25); border-color: var(--teal); }
.ask-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin-top: 10px; }
.lim { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--gray); }
.lim select { min-height: 44px; border: 1px solid var(--rule); border-radius: 10px; padding: 0 10px; background: #fff; color: var(--navy); font-size: 15px; }
.ask-row .btn { margin-left: auto; }

/* ---- program and answer ---- */
.twocol { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.hex { font-family: var(--mono); font-size: 13px; line-height: 1.7; color: var(--navy); background: var(--zebra); border: 1px solid var(--off); border-radius: 10px; padding: 10px 12px; word-break: break-all; }
.hex b { display: inline-block; padding: 0 1px; font-weight: 500; }
.hex b.x { background: var(--red); color: #fff; border-radius: 3px; }
.desc { font-family: var(--mono); font-size: 13px; line-height: 1.55; margin: 0; white-space: pre-wrap; color: var(--ink); background: var(--zebra); border: 1px solid var(--off); border-radius: 10px; padding: 10px 12px; }

/* ---- result ---- */
.tally { font-size: 15px; color: var(--navy); margin: 4px 0 8px; }
.tally b { font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; margin: 8px 0 4px; }
table.res { border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; min-width: 320px; }
table.res th, table.res td { text-align: left; padding: 6px 12px; border-bottom: 1px solid var(--off); white-space: nowrap; }
table.res thead th { background: var(--navy); color: #fff; font-weight: 650; font-family: var(--mono); font-size: 13.5px; }
table.res thead th:first-child { border-top-left-radius: 8px; }
table.res thead th:last-child { border-top-right-radius: 8px; }
table.res tbody tr:nth-child(even) { background: var(--zebra); }
table.res td.n { text-align: right; }
table.res td.null { color: var(--gray-2); font-style: italic; }
table.res tr.empty td { color: var(--gray); font-style: italic; }

/* ---- bytes ---- */
.bytes { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.brow { display: grid; grid-template-columns: 17em minmax(40px, 1fr) 7em; gap: 10px; align-items: center; font-size: 14px; }
.brow .lbl { color: #333; }
.brow .val { font-variant-numeric: tabular-nums; text-align: right; color: var(--navy); font-weight: 650; white-space: nowrap; }
.hb { height: 12px; background: var(--off); border-radius: 99px; overflow: hidden; }
.hb > i { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .4s ease-out; }
.hb.ask > i { background: var(--teal); min-width: 4px; }
.hb.rec > i { background: var(--navy-2); }
.hb.json > i { background: #9AA6B4; }
.ratio { font-size: 14.5px; color: var(--teal-2); background: var(--teal-light); border-radius: 10px; padding: 8px 12px; margin-top: 12px; }
.ratio b { font-variant-numeric: tabular-nums; }

/* ---- check ---- */
#check-out { margin-top: 12px; }
.verdict { border-radius: 10px; padding: 10px 12px; font-weight: 650; }
.verdict.ok { background: var(--green-light); color: #1f5e3a; }
.verdict.warn { background: var(--amber-light); color: #6b4308; }
.verdict.bad { background: var(--red-light); color: var(--red); }
.verdict span { display: block; font-weight: 500; font-size: 14.5px; margin-top: 3px; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--teal-2); font-weight: 600; font-size: 14.5px; }
.spin { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(14,124,134,.2); border-top-color: var(--teal); animation: spin .8s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- try to break it ---- */
.breaks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.break { display: flex; flex-direction: column; gap: 3px; text-align: left; border: 1px solid var(--rule); background: #fff; border-radius: 12px; padding: 12px 14px; cursor: pointer; color: var(--ink); }
.break b { color: var(--red); font-size: 15.5px; }
.break span { color: var(--gray); font-size: 13.5px; }
.break:hover { border-color: var(--red); background: var(--red-light); }
.break[disabled] { opacity: .45; cursor: default; }
#break-note { margin-top: 12px; }

/* ---- real and simulated ---- */
.real { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.real h3 { margin-top: 0; }
.real ul { margin: 0; padding-left: 20px; }
.real li { margin: 4px 0; }

.appfoot { color: var(--gray); font-size: 13.5px; padding: 22px 0 36px; }

/* ---- smaller screens ---- */
@media (max-width: 900px) {
  .twocol { grid-template-columns: minmax(0, 1fr); }
  .breaks { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .embedded .wrap { padding-left: 0; padding-right: 0; }
  h1 { font-size: 25px; }
  .lead { font-size: 16px; }
  .panel { padding: 14px 14px 16px; }
  .panel h2 { font-size: 20px; }
  .plants { gap: 12px 14px; }
  .dots { grid-template-columns: repeat(10, 10px); grid-auto-rows: 10px; gap: 3px; }
  .dot { width: 10px; height: 10px; }
  .ask-row .btn { margin-left: 0; flex: 1 1 100%; }
  .lim { flex: 1 1 40%; }
  .brow { grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; }
  .brow .lbl { grid-row: 1; grid-column: 1; }
  .brow .val { grid-row: 1; grid-column: 2; }
  .brow .hb { grid-row: 2; grid-column: 1 / -1; }
  .real { grid-template-columns: minmax(0, 1fr); }
  .load span, .progress .pct { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .bar > i, .hb > i, .dot { transition: none; }
  .spin { animation: none; }
}
