/* The four long pages: the assistant, the contract check, the clauses and the
   law. Each is one column to read, with lines between its parts instead of
   boxes round them; the clauses and the law have a list of what is on the page
   beside them. */

/* --- a list of what is on the page, beside it -------------------------------------- */
.withindex { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; align-items: start; }
.pageindex { position: sticky; top: calc(var(--top-h) + 20px); max-height: calc(100dvh - var(--top-h) - 40px); overflow-y: auto; padding-right: 6px; font-size: 13.5px; line-height: 1.3; }
.pageindex ol { border-left: 1px solid var(--line); }
.pageindex li a { display: block; margin-left: -1px; padding: 6px 0 6px 12px; text-decoration: none; color: var(--ink-2); border-left: 1px solid transparent; }
.pageindex li a:hover { color: var(--ink); }
.pageindex li a[aria-current] { color: var(--ink); font-weight: 500; border-left-color: var(--accent); }
.indexhead { margin-bottom: 8px; color: var(--ink-3); }
.indexgroup { margin-top: 16px; }
.indexgroup > p { margin-bottom: 4px; font-weight: 600; font-size: 13px; }

/* --- the assistant -------------------------------------------------------------------- */
#ask.page, #contract.page { max-width: 760px; }   /* one column to read, in the middle of the screen */
.chat { display: grid; gap: 18px; padding: 0; background: none; border: 0; }
.chat > * + * { margin-top: 0; }
.chatlog { display: grid; gap: 14px; }
.chatlog:empty { display: none; }
.msg { max-width: min(640px, 92%); }
.msg.you { justify-self: end; padding: 9px 14px; background: var(--soft); border-radius: var(--radius) var(--radius) 3px var(--radius); }
.msg.bot { justify-self: start; }
.msg.bot > * + * { margin-top: .7em; }
.msg.bot ul { padding-left: 1.2em; list-style: disc; }
.msg.bot h4 { margin-top: 1em; }
.msg.note { justify-self: center; max-width: 100%; font-size: 13px; color: var(--ink-2); }
.waiting::after { content: "…"; animation: wait 1.2s steps(4) infinite; display: inline-block; width: 1.2em; overflow: hidden; vertical-align: bottom; }
@keyframes wait { from { width: 0; } to { width: 1.2em; } }
.chatform { display: grid; gap: 10px; }
/* questions to try: a plain list, one to a line */
.chat .chips { display: grid; gap: 0; border-top: 1px solid var(--line); }
.chat .chip { padding: 10px 0; font-weight: 400; font-size: 14.5px; white-space: normal; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.chat .chip:hover { color: var(--ink); }

/* --- the contract check ------------------------------------------------------------------ */
#contract .card { padding: 0; background: none; border: 0; border-radius: 0; }
#contract .card.form, .lawcalcs .card.form { display: grid; gap: 14px; }
#contract .card.form > *, .lawcalcs .card.form > * { margin-top: 0; }
#otp-out { display: grid; gap: 28px; }
#otp-out > .card { padding-top: 24px; border-top: 1px solid var(--line); }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 28px; }
.checks dt { font-weight: 600; font-size: 14.5px; }
.checks dd { font-size: 14px; color: var(--ink-2); }
.findings { display: grid; gap: 0; }
.finding { padding: 14px 0; border-top: 1px solid var(--line); }
.finding > * + * { margin-top: 7px; }
.finding .head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.finding .where { font-size: 12.5px; color: var(--ink-3); }
.level { padding: 1px 8px; border-radius: var(--pill); font: 500 12px/1.5 var(--font); color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.level.fix { --c: var(--far-above); }
.level.ask { --c: var(--above); }
.level.ok { --c: var(--below); }
.level.add { --c: var(--in-line); }

/* --- the clauses ----------------------------------------------------------------------------- */
.deals { display: grid; gap: 0; counter-reset: deal; }
.deal { padding: 26px 0; border-top: 1px solid var(--line); counter-increment: deal; scroll-margin-top: calc(var(--top-h) + 8px); }
.deal:first-child { padding-top: 0; border-top: 0; }
.deal h3 { font-size: 17px; }
.deal h3::before { content: counter(deal) ". "; font-weight: 400; color: var(--ink-3); }
.deal > * + * { margin-top: 10px; }
.deal > p { color: var(--ink-2); max-width: 68ch; }
.clause { display: grid; gap: 10px; justify-items: start; padding: 14px 16px; background: var(--soft); border-radius: var(--radius-s); }
.clause p { font-size: 14px; line-height: 1.55; }
.btn.copy { min-height: 30px; padding: 3px 11px; font-size: 13px; background: var(--bg); }
.btn.copy:hover { background: var(--raise); }

/* --- the law ------------------------------------------------------------------------------------ */
.lawcalcs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 16px; align-items: start; }
.calcout { font-size: 14px; color: var(--ink-2); }
.calcout strong { display: block; font: 600 26px/1.15 var(--font); letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.tablewrap { overflow-x: auto; }
#sale-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
#sale-table th, #sale-table td { padding: 7px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
#sale-table th:first-child { text-align: left; font-weight: 400; color: var(--ink-2); white-space: normal; }
#sale-table thead th { font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
#sale-table tr.total > * { font-weight: 600; color: var(--ink); border-bottom: 0; }
.calcnotes { padding-left: 1.1em; list-style: disc; font-size: 12.5px; color: var(--ink-3); }
.lawfind { max-width: 420px; margin-bottom: 22px; }
.lawtopics { display: grid; gap: 30px; }
.lawgroup > h3 { margin-bottom: 8px; font-size: 13.5px; font-weight: 500; color: var(--ink-3); }
.lawtopic { border-top: 1px solid var(--line); scroll-margin-top: calc(var(--top-h) + 8px); }
.lawtopic:last-child { border-bottom: 1px solid var(--line); }
.lawtopic summary { display: grid; gap: 2px; padding: 12px 34px 12px 0; cursor: pointer; list-style: none; position: relative; }
.lawtopic summary::-webkit-details-marker { display: none; }
.lawtopic summary::after { content: "+"; position: absolute; right: 4px; top: 10px; font: 300 22px/1 var(--font); color: var(--ink-3); }
.lawtopic[open] summary::after { content: "–"; }
.lawtopic summary:hover .lawtitle { color: var(--accent); }
.lawtitle { font-weight: 500; font-size: 15.5px; }
.lawsummary { font-size: 13.5px; color: var(--ink-2); }
.lawtopic > :not(summary) { margin: 0 0 16px; }
.lawpoints { padding-left: 1.1em; list-style: disc; max-width: 74ch; }
.lawpoints li + li { margin-top: 8px; }
.cite { display: block; margin-top: 2px; font-size: 12.5px; color: var(--ink-3); }
.flag { display: block; margin-top: 3px; font-size: 12.5px; font-weight: 500; color: var(--above); }
.lawtraps { padding: 12px 14px; background: color-mix(in srgb, var(--above) 10%, transparent); border-radius: var(--radius-s); max-width: 74ch; }
.lawtraps ul { margin-top: 4px; padding-left: 1.1em; list-style: disc; }
.lawsources { font-size: 12.5px; color: var(--ink-3); }

/* --- the box that asks for payment ------------------------------------------------------------- */
.paywall { padding: 16px; border: 1px solid var(--line-2); border-radius: var(--radius); }
.paywall > * + * { margin-top: 12px; }
.offers { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.offer { display: grid; gap: 8px; align-content: start; padding: 14px; background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius-s); }
.offer p { font-size: 13.5px; color: var(--ink-2); }
.offer .price { font-weight: 600; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .withindex { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  /* the list beside the page becomes a row of words above it */
  .pageindex { position: static; max-height: none; padding: 0 0 14px; border-bottom: 1px solid var(--line); }
  .pageindex ol { display: flex; flex-wrap: wrap; gap: 2px 16px; border: 0; }
  .pageindex li a { margin: 0; padding: 4px 0; border: 0; }
  .pageindex li a[aria-current] { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
  .lawcalcs { grid-template-columns: minmax(0, 1fr); }
}
