/* hallmark: shape: app screen; theme: ink, paper colourway, its teal removed at the owner's request; genre: editorial; signature: a running ledger of answers beside a question box that never moves; type: Golos Text throughout because Epilogue has no Cyrillic, JetBrains Mono for code only; sloplint: not run */
/* critique: the risk is one more chat window, so nothing here is a bubble, a card or a chat box at the bottom; an answer is a ruled entry with its figure in bold and its source under it. */
/* waive 22: ink and greys at zero chroma, the page is printed in plain black */

@font-face { font-family: "Golos Text"; font-weight: 400 900; font-display: swap; src: url(fonts/golos-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Golos Text"; font-weight: 400 900; font-display: swap; src: url(fonts/golos-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02FF, U+1E00-1EFF; }
@font-face { font-family: "Golos Text"; font-weight: 400 900; font-display: swap; src: url(fonts/golos-cyrillic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-weight: 400 900; font-display: swap; src: url(fonts/golos-cyrillic-ext.woff2) format("woff2"); unicode-range: U+0460-048F, U+0492-04AF, U+04B2-052F; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(fonts/mono-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(fonts/mono-cyrillic-400.woff2) format("woff2"); unicode-range: U+0400-045F, U+2116; }

:root {
  --color-paper: oklch(99.5% 0 0);
  --color-paper-2: oklch(97% 0 0);
  --color-paper-3: oklch(94% 0 0);
  --color-ink: oklch(16% 0 0);
  --color-ink-2: oklch(30% 0 0);
  --color-muted: oklch(46% 0 0);
  --color-rule: oklch(89% 0 0);
  --color-focus: oklch(16% 0 0);

  --font-body: "Golos Text", sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, monospace;

  --text-xs: 0.8125rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.625rem;
  --text-xl: 2rem;
  --text-2xl: 2.75rem;

  --space-3xs: 0.125rem;
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
  --space-2xl: 4rem;

  --radius-input: 8px;
  --dur-micro: 120ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --bar-height: 3.5rem;
  --desk: 86rem;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--color-paper); color: var(--color-ink);
  font-family: var(--font-body); font-size: var(--text-md); line-height: 1.5;
  font-variant-numeric: tabular-nums lining-nums; font-synthesis: none; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, dl, dd, pre { margin: 0; padding: 0; }
ul { list-style: none; }
button, textarea, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
::selection { background: var(--color-ink); color: var(--color-paper); }

/* top bar */
.bar { position: sticky; top: 0; z-index: 3; background: var(--color-paper); border-bottom: 1px solid var(--color-ink); }
.bar__in {
  max-width: var(--desk); min-height: var(--bar-height); margin-inline: auto; padding-inline: var(--space-xl);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-md);
}
.brand { font-weight: 700; letter-spacing: -0.015em; white-space: nowrap; }
.lang { display: inline-flex; gap: var(--space-2xs); flex: none; }
.lang__key {
  position: relative; min-width: 2.25rem; height: 2rem; border: 0; background: transparent; color: var(--color-muted); font-size: var(--text-sm);
  text-decoration: underline transparent 1px; text-underline-offset: 0.3em;
  transition: color var(--dur-micro) var(--ease-out), text-decoration-color var(--dur-micro) var(--ease-out);
}
.lang__key::before { content: ""; position: absolute; inset: -6px 0; }
.lang__key[aria-pressed="true"] { color: var(--color-ink); font-weight: 600; text-decoration-color: var(--color-ink); }

/* the desk: the question stays, the answers run beside it */
.desk {
  max-width: var(--desk); margin-inline: auto; padding-inline: var(--space-xl);
  display: grid; grid-template-columns: minmax(0, 24rem) minmax(0, 1fr); column-gap: var(--space-2xl); align-items: start;
}
.side {
  position: sticky; top: var(--bar-height); max-height: calc(100dvh - var(--bar-height)); overflow-y: auto;
  padding-block: var(--space-xl) var(--space-lg);
}
.side h1 { font-size: var(--text-2xl); line-height: 1.05; font-weight: 700; letter-spacing: -0.03em; text-wrap: balance; overflow-wrap: break-word; min-width: 0; }
.lead { margin-top: var(--space-md); color: var(--color-ink-2); text-wrap: pretty; }
.side__note { margin-top: var(--space-lg); font-size: var(--text-xs); color: var(--color-muted); }
.main { min-width: 0; padding-block: var(--space-xl) var(--space-2xl); }

/* question */
.ask { margin-top: var(--space-xl); }
.ask__label { display: block; margin-bottom: var(--space-xs); font-size: var(--text-sm); color: var(--color-ink-2); }
.input {
  display: block; width: 100%; min-height: 6rem; max-height: 14rem; padding: var(--space-sm); resize: none; line-height: 1.5;
  border: 1px solid var(--color-muted); border-radius: var(--radius-input); background: var(--color-paper);
  outline: 2px solid transparent; outline-offset: -2px; transition: background-color var(--dur-micro) var(--ease-out);
}
.input:focus-visible { outline-color: var(--color-focus); outline-offset: -2px; }
.input[aria-invalid="true"] { border-color: var(--color-ink); }
.ask__row { margin-top: var(--space-sm); display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.ask__hint { font-size: var(--text-xs); color: var(--color-muted); min-height: 1lh; }
.ask__hint.is-error { color: var(--color-ink); font-weight: 600; }
.key {
  flex: none; min-height: 2.75rem; padding: 0 var(--space-lg); border: 1px solid var(--color-ink); border-radius: var(--radius-input);
  background: var(--color-ink); color: var(--color-paper); font-weight: 600;
  transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out), opacity var(--dur-micro) var(--ease-out);
}
.key:active:not(:disabled) { background: var(--color-ink-2); }
.key:disabled { opacity: 0.55; cursor: not-allowed; }
.key--quiet { background: transparent; color: var(--color-ink); border-color: var(--color-muted); }
.key--quiet:active:not(:disabled) { background: var(--color-paper-3); }

/* before the first question */
.start[hidden] { display: none; }
.start__head { font-size: var(--text-sm); font-weight: 400; color: var(--color-muted); padding-bottom: var(--space-xs); border-bottom: 1px solid var(--color-ink); }
.examples li { border-bottom: 1px solid var(--color-rule); }
.example {
  display: block; width: 100%; min-height: 3.5rem; padding: var(--space-md) 0; border: 0; background: transparent; text-align: start; font-size: 1.125rem;
  text-decoration: underline transparent 1px; text-underline-offset: 0.2em; transition: text-decoration-color var(--dur-micro) var(--ease-out);
}
.example:active { color: var(--color-ink-2); }

/* the ledger */
.thread:empty { display: none; }
.entry { min-width: 0; border-top: 1px solid var(--color-ink); padding-block: var(--space-sm) var(--space-xl); }
.entry__meta { display: flex; gap: var(--space-md); font-size: var(--text-xs); color: var(--color-muted); }
.entry__no { min-width: 1.5rem; }
.entry__time { margin-inline-start: auto; }
.entry__q { margin-top: var(--space-lg); font-size: var(--text-md); font-weight: 400; color: var(--color-ink-2); overflow-wrap: anywhere; }
.entry__text { margin-top: var(--space-xs); font-size: var(--text-lg); line-height: 1.3; letter-spacing: -0.012em; overflow-wrap: anywhere; text-wrap: pretty; max-width: 46rem; }
.entry__text strong { font-weight: 700; white-space: nowrap; }
.entry__tables { margin-top: var(--space-lg); display: flex; flex-direction: column; gap: var(--space-md); }
.entry__tables:empty { display: none; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th { text-align: start; font-weight: 400; color: var(--color-muted); padding: var(--space-xs) var(--space-md) var(--space-xs) 0; border-bottom: 1px solid var(--color-ink); white-space: nowrap; }
td { padding: var(--space-xs) var(--space-md) var(--space-xs) 0; border-bottom: 1px solid var(--color-rule); vertical-align: top; overflow-wrap: break-word; }
th.num, td.num { text-align: end; white-space: nowrap; }
th:last-child, td:last-child { padding-inline-end: 0; }
table.card thead { display: none; }
table.card tr:first-child td { border-top: 1px solid var(--color-ink); }
table.card td:first-child { color: var(--color-muted); width: 34%; }

.notes { margin-top: var(--space-md); display: flex; flex-direction: column; gap: var(--space-2xs); font-size: var(--text-sm); color: var(--color-ink-2); max-width: 46rem; }
.notes:empty { display: none; }

.basis { margin-top: var(--space-lg); font-size: var(--text-sm); }
.basis[hidden] { display: none; }
.basis__head { font-size: var(--text-sm); font-weight: 600; }
.filters { margin-top: var(--space-2xs); display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); gap: var(--space-3xs) var(--space-md); }
.filters:empty { display: none; }
.filters dt { color: var(--color-muted); }
.filters dd { overflow-wrap: anywhere; }
.deals { margin-top: var(--space-xs); display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-sm); align-items: baseline; }
.deals[hidden] { display: none; }
.deals__label { color: var(--color-muted); }
.deal {
  position: relative; border: 0; padding: 0; background: transparent; color: var(--color-ink);
  text-decoration: underline var(--color-rule) 1px; text-underline-offset: 0.2em; transition: text-decoration-color var(--dur-micro) var(--ease-out);
}
.deal::before { content: ""; position: absolute; inset: -0.75rem -0.25rem; }
.deal:active { color: var(--color-ink-2); }
.query { margin-top: var(--space-xs); }
.query[hidden] { display: none; }
.query summary { cursor: pointer; color: var(--color-ink-2); min-height: 1.75rem; width: fit-content; }
.sql {
  margin-top: var(--space-2xs); padding: var(--space-sm); border-radius: var(--radius-input); background: var(--color-paper-2);
  font-family: var(--font-code); font-size: var(--text-xs); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
}
.sql + .sql { margin-top: var(--space-2xs); }
.retry { margin-top: var(--space-md); }

/* waiting */
.skel { background: var(--color-paper-3); margin-top: var(--space-sm); animation: breathe 1600ms ease-in-out infinite; }
.skel--wide { height: 1.75rem; width: 82%; }
.skel--mid { height: 1.75rem; width: 48%; }
.skel--row { height: 0.875rem; width: 100%; }
@keyframes breathe { 50% { opacity: 0.45; } }

@media (hover: hover) {
  .lang__key:not([aria-pressed="true"]):hover { color: var(--color-ink); }
  .example:hover { text-decoration-color: var(--color-ink); }
  .deal:hover { text-decoration-color: var(--color-ink); }
  .input:hover:not(:focus-visible) { background: var(--color-paper-2); }
  .key:hover:not(:disabled) { background: var(--color-ink-2); }
  .key--quiet:hover:not(:disabled) { background: var(--color-paper-2); }
  .query summary:hover { color: var(--color-ink); }
}

@media (max-width: 60rem) {
  .bar__in, .desk { padding-inline: var(--space-md); }
  .desk { display: block; }
  .side { position: static; max-height: none; overflow: visible; padding-block: var(--space-lg) 0; }
  .side h1 { font-size: var(--text-xl); }
  .ask { margin-top: var(--space-lg); }
  .input { min-height: 4.5rem; }
  .side__note { margin-top: var(--space-sm); }
  .main { padding-block: var(--space-lg) var(--space-xl); }
  .has-answers .side h1, .has-answers .lead, .has-answers .side__note { display: none; }
  .has-answers .ask { margin-top: 0; }
  .entry__text { font-size: 1.375rem; }
  .example { font-size: var(--text-md); }
  .scroll td:first-child, .scroll th:first-child { position: sticky; left: 0; background: var(--color-paper); max-width: 10rem; }
  table.card td:first-child { position: static; width: 40%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
