/*
 * Author: Hariram S <ramhari4090@gmail.com>
 *
 * Styles for the comparison page with chat assistants: the drawn side-by-side
 * picture (a chat thread next to a dashboard), the cost calculator and the
 * sources list. Built on the tokens in site.css (--surface, --line, --muted,
 * --accent) so it stays in the same dark style; the picture uses neutral
 * shapes and text labels only, with no vendor's look or logo.
 *
 * The calculator's form fields are at least 44 px tall for touch, show focus
 * with the site's violet outline, and mark out-of-range values with a text
 * message as well as the red border (compare.js sets aria-invalid). The result
 * table and the form stack in one column below 900 px.
 *
 * Used by:
 *     landing/dotwave-vs-chatgpt-and-claude.html
 *
 * Depends on:
 *     landing/assets/site.css (tokens, .flow, .tbl-wrap, table.opts, breakpoints)
 *     landing/assets/compare.js (.has-js on the calculator, aria-invalid on fields)
 */

/* Side-by-side picture */
.cmp-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gut); margin-top: clamp(32px, 4vw, 48px); }
.cmp-panel { margin: 0; display: flex; flex-direction: column; gap: 14px; }
.cmp-frame { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); min-height: 360px; }
.cmp-panel figcaption { font-size: var(--t5); line-height: 1.55; color: var(--muted); }
.cmp-panel figcaption b { color: #fff; font-weight: 600; }
.cmp-bar { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font: 500 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.cmp-bar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.cmp-dash .cmp-bar .dot { background: var(--accent); }

.cmp-msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; color: #d4d4d8; background: var(--surface-2); border: 1px solid var(--line); }
.cmp-msg.me { align-self: flex-end; background: rgba(255, 255, 255, .08); color: #fff; border-bottom-right-radius: 4px; }
.cmp-msg.ai { align-self: flex-start; border-bottom-left-radius: 4px; }
.cmp-file { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font: 500 12px/1.4 var(--mono); color: var(--muted); }
.cmp-file .ic { width: 14px; height: 14px; }
.cmp-mini { display: flex; align-items: flex-end; gap: 6px; height: 54px; margin-top: 10px; padding: 6px; border-radius: 8px; background: rgba(255, 255, 255, .04); }
.cmp-mini i { flex: 1; height: var(--h); border-radius: 3px 3px 0 0; background: #71717a; }
.cmp-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.cmp-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); opacity: .5; }

.cmp-dh { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cmp-dh b { margin-right: auto; font-size: 15px; color: #fff; }
.cmp-chip { display: inline-block; padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 12px; color: #d4d4d8; }
.cmp-kpi { display: flex; flex-direction: column; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.cmp-kpi span { font-size: 12px; color: var(--muted); }
.cmp-kpi b { font-size: 26px; font-weight: 600; letter-spacing: -0.03em; color: #fff; }
.cmp-bars { flex: 1; display: flex; align-items: flex-end; gap: 10px; min-height: 110px; padding: 8px 4px 22px; border-bottom: 1px solid var(--line); }
.cmp-bars i { position: relative; flex: 1; height: var(--h); border-radius: 4px 4px 0 0; background: var(--accent); }
.cmp-bars em { position: absolute; left: 50%; bottom: -20px; transform: translateX(-50%); font: 400 11px/1 var(--mono); font-style: normal; color: var(--muted); white-space: nowrap; }
.cmp-status { margin: 0; font: 400 12px/1.5 var(--mono); color: var(--muted); }
.cmp-status.ok { color: #86efac; }

/* Each card's labels sit above their own text: one column per dt/dd pair,
   filled column by column, instead of the shared grid's row-by-row flow. */
.flow.cmp-flow > li:has(.flow-pic:empty) .flow-text dl { grid-template-columns: none; grid-auto-columns: minmax(0, 1fr); grid-template-rows: auto auto; grid-auto-flow: column; row-gap: 6px; }
.cmp-flow .flow-text dd { margin: 0; }

/* Comparison table: three columns read better a little wider than the shared default */
table.cmp-table { min-width: 720px; }
table.cmp-table tbody th { width: 20%; }
table.cmp-table td { width: 40%; }

.cmp-list { padding-left: 1.2em; display: grid; gap: 14px; }
.cmp-list li::marker { color: var(--accent-ink); }

/* Calculator */
.calc { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--gut); margin-top: clamp(32px, 4vw, 48px); align-items: start; }
.calc-form { display: grid; gap: 16px; }
.calc-form fieldset { margin: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px var(--gut); }
.calc-form legend { padding: 0 6px; font: 500 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld label { font-size: 14px; font-weight: 500; line-height: 1.4; color: #fff; }
.fld input[type="number"], .fld select {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--surface-2); color: #fff; font: 500 15px/1.4 var(--font); color-scheme: dark;
}
.fld select { cursor: pointer; }
.fld input:focus-visible, .fld select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fld input[aria-invalid="true"] { border-color: #f87171; }
.fld .hint { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.fld .err { margin: 0; font-size: 13px; line-height: 1.5; color: #fca5a5; }
.fld .err:empty { display: none; }
.fld-check { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 10px; }
.fld-check input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: none; }
.fld-check label { font-weight: 400; color: #d4d4d8; }

.calc-out { position: sticky; top: 88px; padding: 22px; border: 1px solid rgba(124, 92, 255, .45); border-radius: var(--r); background: radial-gradient(80% 60% at 50% 0%, rgba(124, 92, 255, .14), transparent 70%), var(--surface); }
.calc-h { font: 500 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.calc-tbl { width: 100%; margin-top: 12px; border-collapse: collapse; font-size: 15px; color: #d4d4d8; font-variant-numeric: tabular-nums; }
.calc-tbl th, .calc-tbl td { padding: 10px 8px 10px 0; text-align: right; border-bottom: 1px solid var(--line); }
.calc-tbl th:first-child { text-align: left; }
.calc-tbl thead th { font: 500 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.calc-tbl tbody th { font-weight: 500; color: #d4d4d8; }
.calc-tbl .u { display: block; font-size: 12px; color: var(--muted); }
.calc-tbl .tot th, .calc-tbl .tot td { border-bottom: 0; font-weight: 600; color: #fff; font-size: 17px; }
.calc-sum { margin-top: 16px; font-size: 17px; line-height: 1.5; font-weight: 500; color: #fff; }
.calc-note, .calc-nojs { margin-top: 12px; font-size: 13px; line-height: 1.55; color: var(--muted); }
.calc.has-js .calc-nojs { display: none; }

.cmp-sources { margin-top: 20px; padding-left: 1.2em; display: grid; gap: 10px; font-size: 14px; line-height: 1.55; color: #d4d4d8; }
.cmp-sources b { color: #fff; font-weight: 600; margin-right: 4px; }
.cmp-sources a { overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .flow.cmp-flow > li:has(.flow-pic:empty) .flow-text dl { grid-auto-flow: row; grid-template-rows: none; grid-auto-columns: auto; }
  .cmp-flow .flow-text dt:not(:first-child) { margin-top: 10px; }
  .cmp-split, .calc { grid-template-columns: 1fr; }
  .cmp-frame { min-height: 0; }
  .calc-out { position: static; }
}
@media (max-width: 560px) {
  .calc-form fieldset { grid-template-columns: 1fr; padding: 16px; }
  .cmp-msg { max-width: 100%; }
}

/* Verdict words in the Forms comparison table: text first, colour second */
.vd { display: inline-block; margin-bottom: 6px; padding: 2px 8px; border: 1px solid var(--line-2); border-radius: 999px; font: 500 11px/1.5 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: #d4d4d8; }
.vd-yes { border-color: rgba(124, 92, 255, .6); color: var(--accent-ink); }
.vd-part { border-style: dashed; }
.vd-no { color: var(--muted); }
table.cmp-forms { min-width: 760px; }
table.cmp-forms tbody th { width: 22%; }
table.cmp-forms td { width: 39%; }
table.cmp-forms td > span:not(.vd) { display: block; }
@media (max-width: 700px) {
  .tbl-wrap:has(.cmp-forms) { overflow: visible; border: 0; background: none; }
  table.cmp-forms { min-width: 0; }
  table.cmp-forms thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.cmp-forms, table.cmp-forms tbody, table.cmp-forms tr, table.cmp-forms th, table.cmp-forms td { display: block; width: 100%; }
  table.cmp-forms tbody tr { margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
  table.cmp-forms tbody th { width: 100%; border-bottom: 1px solid var(--line); font-size: 16px; }
  table.cmp-forms td { width: 100%; }
  table.cmp-forms tr:last-child td:last-child { border-bottom: 0; }
  table.cmp-forms td::before { content: attr(data-label); display: block; margin-bottom: 6px; font: 500 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
  table.cmp-forms tr:last-child th, table.cmp-forms tr:last-child td { border-bottom: 1px solid var(--line); }
  table.cmp-forms tr:last-child td:last-child { border-bottom: 0; }
}
