/* The page of ifc-sql view, and of the demo on GitHub Pages: the model full screen, with
   the answer card, the Ask Claude panel, the view pill and the panels floating over it.
   The tokens are those of Kees's CV site (its style.css, section 1). No inline styles
   anywhere: the content security policy allows only this file. Light only. */

/* Nunito, vendored (vendor/nunito/: @fontsource-variable/nunito 5.3.0, SIL OFL 1.1): one
   variable font for every weight, in two subsets, as its package's wght.css splits them. */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url("vendor/nunito/nunito-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url("vendor/nunito/nunito-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Colour */
  --bg: #ffffff;
  --surface: #f7f8f9;
  --surface-alt: #fafbfc;
  --hover: #f0f2f4;
  --ink: #1a1f24;
  --ink-2: #586069;
  --ink-3: #6b7480;
  --teal: #0e8192;
  --teal-dark: #0a6473;
  --teal-ink: #0a6b7a; /* small teal text: 5.9:1 on white */
  --teal-08: rgb(14 129 146 / 0.08);
  --teal-15: rgb(14 129 146 / 0.15);
  --teal-20: rgb(14 129 146 / 0.2);
  --teal-gradient: linear-gradient(135deg, #0e8192, #0a6473);
  --line: #d1d5da;
  --line-2: #e1e4e8;
  --line-3: #f0f3f6;
  --canvas: #eef0f3;
  --error: #b42318;

  /* Type */
  --font: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --size-2xs: clamp(0.7rem, 0.9vw, 0.75rem);
  --size-xs: clamp(0.75rem, 1vw, 0.8125rem);
  --size-sm: clamp(0.8125rem, 1.1vw, 0.875rem);
  --size-base: clamp(0.9375rem, 1.2vw, 1rem);
  --size-xl: clamp(1.25rem, 2vw, 1.5rem);
  --size-2xl: clamp(1.5rem, 2.5vw, 1.875rem);

  /* Shape */
  --radius-pill: 6px;
  --radius-card: 14px;
  --radius-dialog: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.06), 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -1px rgb(0 0 0 / 0.04);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -2px rgb(0 0 0 / 0.04);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 10px 10px -5px rgb(0 0 0 / 0.04);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.15);
  --ring: 0 0 0 4px var(--teal-20);

  /* Motion: the CV's ease-out-expo */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --move: 500ms;

  /* Layout */
  --gap: 20px;
  --panel-w: 400px;
  --side-w: 360px;
  --ask-h: 48px;
  --badge-h: 40px; /* below the box: its line, and the panel's padding */
  --shift: 120px; /* how far the model moves right while the panel is open */

  color-scheme: light;
  interpolate-size: allow-keywords; /* the card's height, from auto, where browsers can */
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--size-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

button,
select,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

a {
  color: var(--teal-ink);
  font-weight: 600;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--mono);
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

[hidden] {
  display: none !important;
}

* {
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
}

.muted {
  color: var(--ink-3);
}

.error {
  color: var(--error);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon .fill {
  fill: currentColor;
  stroke: none;
}

.mark {
  width: 30px;
  height: 30px;
  flex: none;
  fill: none;
  stroke: var(--teal);
  stroke-width: 2.4;
  stroke-linejoin: round;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--teal-ink);
  font-size: var(--size-xs);
  font-weight: 600;
}

.link:hover {
  text-decoration: underline;
}

.x {
  display: grid;
  width: 34px;
  height: 34px;
  flex: none;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink-3);
  font-size: 22px;
  line-height: 1;
}

.x:hover {
  background: var(--hover);
  color: var(--ink);
}

.round {
  display: grid;
  width: 34px;
  height: 34px;
  flex: none;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-full);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  color: var(--teal-ink);
  font-weight: 700;
}

.round:hover {
  border-color: var(--teal-15);
  background: var(--teal-08);
}

/* ------------------------------------------------------------------ the model */

.canvas {
  position: fixed;
  inset: 0;
  transition: transform var(--move) var(--ease);
}

.canvas canvas {
  display: block;
  cursor: grab;
}

.canvas canvas:active {
  cursor: grabbing;
}

body.asking .canvas {
  transform: translateX(var(--shift));
}

.status {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 4;
  max-width: min(420px, calc(100% - 32px));
  padding: 10px 16px;
  transform: translate(-50%, -50%);
  border-radius: var(--radius-full);
  background: rgb(255 255 255 / 0.92);
  box-shadow: var(--shadow-lg);
  color: var(--ink-2);
  font-size: var(--size-sm);
  font-weight: 600;
  text-align: center;
}

.status .link {
  font-size: inherit;
}

.status:empty {
  display: none;
}

/* ------------------------------------------------------------------ the answer card, the panel */

.panel {
  position: fixed;
  left: var(--gap);
  top: var(--gap);
  z-index: 10;
  display: flex;
  width: var(--panel-w);
  height: auto;
  max-height: calc(100% - 2 * var(--gap) - var(--ask-h) - 16px);
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--bg);
  box-shadow: var(--shadow-xl), 0 0 0 1px var(--line-2);
  transition:
    height var(--move) var(--ease),
    max-height var(--move) var(--ease);
}

body.asking .panel {
  height: calc(100% - 2 * var(--gap));
  max-height: calc(100% - 2 * var(--gap));
}

.panel-head {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-3);
}

.who {
  flex: 1;
  min-width: 0;
}

.who .brand-name {
  display: block;
}

.swap {
  position: relative;
  height: 18px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 18px;
}

.swap > span {
  position: absolute;
  left: 0;
  top: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 260ms ease;
}

.swap .on-open {
  color: var(--teal-ink);
  font-weight: 600;
  opacity: 0;
}

body.asking .swap .on-open {
  opacity: 1;
}

body.asking .swap .on-closed {
  opacity: 0;
}

/* Closed, the × is neither seen nor reached with Tab. */
#ask-close {
  width: 0;
  margin-left: -12px;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  transition:
    width var(--move) var(--ease),
    margin var(--move) var(--ease),
    opacity 200ms ease,
    visibility 0s linear var(--move);
}

body.asking #ask-close {
  width: 34px;
  margin-left: 0;
  visibility: visible;
  opacity: 1;
  transition:
    width var(--move) var(--ease),
    margin var(--move) var(--ease),
    opacity 200ms ease,
    visibility 0s;
}

/* The history: in the open panel, above the answer, newest at the bottom. */

.earlier {
  display: none;
}

/* The history and the answer scroll as one; open, they sit at the bottom, like a chat. */
.thread {
  position: relative; /* the answer's offsetTop is within it: main.js scrolls to it */
  display: flex;
  flex: 0 1 auto;
  min-height: 0;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.thread > :first-child {
  margin-top: auto;
}

body.asking .thread {
  flex: 1 1 auto;
}

.history {
  display: flex;
  flex: none;
  height: 0;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px;
  overflow: hidden; /* clips the rows while it grows */
  visibility: hidden;
  opacity: 0;
  transition:
    height var(--move) var(--ease),
    padding var(--move) var(--ease),
    opacity 300ms ease,
    visibility 0s linear 300ms;
}

body.asking .history {
  height: auto;
  padding: 12px 16px 2px;
  visibility: visible;
  opacity: 1;
  transition:
    height var(--move) var(--ease),
    padding var(--move) var(--ease),
    opacity 300ms ease 140ms,
    visibility 0s;
}

.past {
  display: flex;
  width: 100%;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line-3);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
}

.past:hover:not(:disabled) {
  border-color: var(--teal-15);
  background: var(--teal-08);
}

.past:disabled {
  opacity: 0.75;
}

.num {
  display: grid;
  width: 22px;
  height: 22px;
  flex: none;
  place-items: center;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.past .num {
  border: 1.5px solid var(--line);
  color: var(--ink-3);
}

.past-text {
  min-width: 0;
}

.past .q {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.past .a {
  display: block;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.3;
}

.past .tool {
  font-family: var(--mono);
  font-size: 11px;
}

.past.failed .a {
  color: var(--error);
}

/* The current answer: the same block, closed or open. */

.current {
  position: relative;
  flex: none;
  padding: 14px 18px;
  transition: padding var(--move) var(--ease);
}

.current::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 16px;
  bottom: 16px;
  width: 4px;
  border-radius: var(--radius-full);
  background: var(--teal-gradient);
  opacity: 0;
  transition: opacity 300ms ease;
}

body.asking .current {
  padding-left: 26px;
}

body.asking .current::before {
  opacity: 1;
}

/* The list of questions covers the answer: its bar would show beside the list. */
body.asking .panel:has(.question-list:not([hidden])) .current::before {
  opacity: 0;
}

.qline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.qline .num {
  background: var(--teal);
  color: #fff;
}

.qline .q {
  flex: 1;
  min-width: 0;
  font-size: inherit;
}

.stepper {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 2px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stepper button {
  display: grid;
  width: 24px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  color: var(--teal-ink);
  font-size: 18px;
  line-height: 1;
}

.stepper button:hover:not(:disabled) {
  background: var(--teal-08);
}

.stepper button:disabled {
  color: var(--line);
}

.big {
  margin-top: 10px;
  font-size: var(--size-2xl);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.big small {
  display: block;
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
}

.intro {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 15px;
}

.note {
  margin-top: 8px;
  color: var(--ink-3);
  font-size: var(--size-xs);
}

.stale {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--size-xs);
}

.legend {
  margin: 10px 0 0;
}

.legend button {
  display: flex;
  width: calc(100% + 16px);
  align-items: center;
  gap: 10px;
  margin: 0 -8px;
  padding: 5px 8px;
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  font-size: 14px;
  text-align: left;
}

.legend button:hover {
  background: var(--hover);
}

.legend button[aria-pressed="true"] {
  background: var(--teal-08);
  color: var(--teal-ink);
  font-weight: 600;
}

.sw {
  --swatch: #c9ccd1;
  width: 12px;
  height: 12px;
  flex: none;
  border-radius: 3px;
  background: var(--swatch);
}

.legend .t {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend .c {
  color: var(--ink-2);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* How it was answered: one click away. */

.how {
  margin-top: 8px;
  border-top: 1px solid var(--line-3);
  font-size: 13px;
}

.how summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-top: 10px;
  color: var(--teal-ink);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.how summary::-webkit-details-marker {
  display: none;
}

.how summary::before {
  content: "";
  width: 0;
  height: 0;
  flex: none;
  align-self: center;
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
  border-left: 6px solid currentColor;
  transition: transform 200ms ease;
}

.how[open] summary::before {
  transform: rotate(90deg);
}

.how summary .muted {
  margin-left: auto;
  font-weight: 500;
  white-space: nowrap;
}

.how-body {
  display: grid;
  gap: 8px;
  padding: 10px 0 2px;
  color: var(--ink-2);
}

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 2px 12px;
  margin: 0;
}

.facts dt {
  color: var(--ink-3);
}

.facts dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.sql {
  max-height: 220px;
  margin: 0;
  padding: 8px 10px;
  overflow: auto;
  border: 1px solid var(--line-3);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
}

/* The composer: room for the box, which is the button itself. No opacity here: it would
   fade the button too, which is fixed but still its child. */

.composer {
  position: relative;
  flex: none;
  height: 0;
  padding: 0 14px;
  overflow: hidden;
  border-top: 1px solid transparent;
  background: var(--surface-alt);
  transition:
    height var(--move) var(--ease),
    border-color 200ms ease;
}

body.asking .composer {
  height: auto;
  overflow: visible;
  border-top-color: var(--line-2);
}

/* Closed, what the open panel holds is neither seen nor reached with Tab. */
.next,
.badge {
  visibility: hidden;
  opacity: 0;
  transition:
    opacity 260ms ease,
    visibility 0s linear 260ms;
}

body.asking .next,
body.asking .badge {
  visibility: visible;
  opacity: 1;
  transition:
    opacity 260ms ease 160ms,
    visibility 0s;
}

.next {
  display: flex;
  height: 30px;
  align-items: center;
  gap: 6px;
  margin: 10px 0 8px;
  overflow: hidden;
}

.next:empty {
  height: 0;
  margin: 6px 0 0;
}

.next .muted {
  flex: none;
  font-size: 12px;
}

.chip {
  flex: none;
  max-width: 100%;
  padding: 3px 10px;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--teal-08);
  color: var(--teal-ink);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip:hover {
  background: var(--teal-15);
}

.slot {
  height: var(--ask-h);
}

.badge {
  display: flex;
  height: var(--badge-h);
  align-items: center;
  gap: 6px;
  padding-bottom: 6px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 18px;
}

.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: var(--radius-full);
  background: var(--teal);
  opacity: 0.6;
}

.badge[data-state="interrupted"]::before,
.badge[data-state="off"]::before {
  background: var(--error);
}

.badge .link {
  font-size: inherit;
}

/* The button that becomes the box. */

.ask {
  position: fixed;
  left: var(--gap);
  bottom: var(--gap);
  z-index: 11;
  width: 150px;
  height: var(--ask-h);
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 24px;
  background: var(--teal-gradient);
  box-shadow:
    0 10px 20px -6px rgb(14 129 146 / 0.45),
    var(--shadow-lg);
  transition:
    left var(--move) var(--ease),
    bottom var(--move) var(--ease),
    width var(--move) var(--ease),
    border-radius var(--move) var(--ease),
    border-color 300ms ease,
    box-shadow 300ms ease;
}

.ask::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}

body.asking .ask {
  left: calc(var(--gap) + 14px);
  bottom: calc(var(--gap) + var(--badge-h));
  width: calc(var(--panel-w) - 28px);
  border-color: var(--line);
  border-radius: 12px;
  box-shadow: none;
}

body.asking .ask:focus-within {
  border-color: var(--teal);
  box-shadow: var(--ring);
}

body.asking .ask::after {
  opacity: 1;
}

.ask-open,
.box {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  transition: opacity 240ms ease;
}

.ask-open {
  gap: 9px;
  padding: 0 18px 0 16px;
  border: 0;
  border-radius: inherit;
  background: none;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.ask-open .icon {
  fill: #fff;
  stroke: none;
}

.ask-open .icon .faint {
  opacity: 0.75;
}

.ask-open:focus-visible {
  box-shadow: inset 0 0 0 3px rgb(255 255 255 / 0.6);
}

.box {
  gap: 8px;
  padding: 0 6px 0 14px;
  opacity: 0;
  visibility: hidden;
}

body.asking .ask-open {
  opacity: 0;
  visibility: hidden;
}

body.asking .box {
  opacity: 1;
  visibility: visible;
  transition-delay: 180ms;
}

.field {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  font-size: 15px;
}

.field:focus-visible {
  box-shadow: none;
}

.field::placeholder {
  color: var(--ink-3);
  opacity: 1;
}

.field:disabled {
  color: var(--ink-2);
}

.list-toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 0;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.list-toggle .icon {
  width: 15px;
  height: 15px;
}

.list-toggle:hover,
.list-toggle[aria-expanded="true"] {
  background: var(--teal-08);
  color: var(--teal-ink);
}

.send {
  display: grid;
  width: 34px;
  height: 34px;
  flex: none;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--teal);
  color: #fff;
}

.send:disabled {
  background: var(--line-2);
  color: var(--ink-3);
}

.ask-note {
  position: fixed;
  left: calc(var(--gap) + 162px);
  bottom: calc(var(--gap) + 12px);
  z-index: 11;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: rgb(255 255 255 / 0.85);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  transition: opacity 200ms ease;
}

body.asking .ask-note {
  opacity: 0;
  visibility: hidden;
}

/* The list of questions, above the box. */

.question-list {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(var(--badge-h) + var(--ask-h) + 8px);
  z-index: 12;
  max-height: min(430px, calc(100vh - 220px));
  padding: 8px;
  overflow-y: auto;
  border-radius: 12px;
  background: var(--bg);
  box-shadow: var(--shadow-xl), 0 0 0 1px var(--line-2);
}

.list-title {
  margin: 4px 8px 6px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
}

.options li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

.options li .num {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--line);
  color: var(--ink-3);
  font-size: 10px;
}

.options li .tag {
  margin-left: auto;
  color: var(--ink-3);
  font-size: 12px;
  white-space: nowrap;
}

.options li[aria-selected="true"],
.options li:hover {
  background: var(--teal-08);
  color: var(--teal-ink);
  font-weight: 600;
}

.options li[aria-selected="true"] .num,
.options li:hover .num {
  border-color: var(--teal);
  color: var(--teal-ink);
}

.options li[aria-disabled="true"] {
  color: var(--ink-3);
  font-weight: 400;
  cursor: default;
}

.options li[aria-disabled="true"]:hover {
  background: none;
}

.options li[aria-disabled="true"] .num {
  border-color: var(--line);
  color: var(--ink-3);
}

.own {
  margin: 6px 0 0;
  padding: 10px 8px 4px;
  border-top: 1px solid var(--line-3);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.4;
}

.own .link {
  font-size: inherit;
}

.own.alone {
  margin: 0;
  border-top: 0;
}

/* ------------------------------------------------------------------ over the model */

.fab {
  display: inline-flex;
  height: 40px;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-full);
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
}

.fab:hover {
  color: var(--ink);
}

.fab[aria-expanded="true"] {
  border-color: var(--teal-15);
  background: #eef6f7;
  color: var(--teal-ink);
  font-weight: 700;
}

.model-open {
  position: fixed;
  right: var(--gap);
  top: var(--gap);
  z-index: 9;
  transition: right var(--move) var(--ease);
}

body.side-open .model-open {
  right: calc(var(--side-w) + 2 * 16px);
}

.pill {
  position: fixed;
  left: 50%;
  bottom: calc(var(--gap) + 4px);
  z-index: 8;
  display: flex;
  gap: 2px;
  padding: 4px;
  transform: translateX(-50%);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-full);
  background: rgb(255 255 255 / 0.92);
  box-shadow: var(--shadow-lg);
  transition: transform var(--move) var(--ease);
}

body.asking .pill {
  transform: translateX(calc(-50% + var(--panel-w) / 2 - 60px));
}

body.side-open .pill {
  transform: translateX(calc(-50% - var(--side-w) / 2));
}

body.asking.side-open .pill {
  transform: translateX(calc(-50% + (var(--panel-w) - var(--side-w)) / 2));
}

.pill button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 0;
  border-radius: var(--radius-full);
  background: none;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.pill .icon {
  width: 16px;
  height: 16px;
}

.pill button:hover:not(:disabled) {
  background: var(--hover);
  color: var(--ink);
}

.pill button:disabled {
  color: #a6acb3;
}

.pill button[aria-pressed="true"] {
  background: var(--teal-08);
  color: var(--teal-ink);
}

.fit-round,
.topbar {
  display: none;
}

/* The demo's credit: in the corner, as a map credits its tiles, below the pill's row. */
.credit {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 7;
  padding: 1px 10px;
  border-radius: 8px 0 0;
  background: rgb(255 255 255 / 0.85);
  color: var(--ink-2);
  font-size: 11px;
  line-height: 16px;
  transition: right var(--move) var(--ease);
}

body.side-open .credit {
  right: calc(var(--side-w) + 16px);
  border-radius: 8px 8px 0 0;
}

.toast {
  position: fixed;
  left: 50%;
  top: var(--gap);
  z-index: 30;
  display: flex;
  max-width: min(560px, calc(100% - 32px));
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  transform: translateX(-50%);
  border: 1px solid var(--line-2);
  border-left: 4px solid var(--error);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: var(--shadow-xl);
  font-size: var(--size-sm);
}

/* ------------------------------------------------------------------ the right side */

.side {
  position: fixed;
  right: 16px;
  top: 16px;
  bottom: 16px;
  z-index: 10;
  display: flex;
  width: var(--side-w);
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--bg);
  box-shadow: var(--shadow-xl), 0 0 0 1px var(--line-2);
  animation: side-in var(--move) var(--ease);
}

@keyframes side-in {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
}

.side-head {
  display: flex;
  flex: none;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 12px 12px 16px;
  border-bottom: 1px solid var(--line-3);
}

.side-title {
  padding-top: 4px;
  font-size: 16px;
  font-weight: 700;
}

.side-body {
  flex: 1;
  min-height: 0;
  padding: 12px 16px 20px;
  overflow-y: auto;
}

.sect + .sect {
  margin-top: 16px;
}

.sect-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
}

.select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--bg);
  font-weight: 600;
}

.select:disabled {
  opacity: 1;
  background: var(--surface-alt);
}

.disciplines > li + li {
  border-top: 1px solid var(--line-3);
}

.disc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 4px;
}

.disc-row .sw {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.disc-row label {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.disc-row b {
  display: block;
  font-size: 14px;
  line-height: 1.25;
}

.disc-row label span,
.model-line {
  display: block;
  overflow: hidden;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.models {
  padding: 0 0 8px 24px;
}

.model-line {
  white-space: normal;
}

.model-line .file {
  font-family: var(--mono);
  font-size: 11px;
}

.model-line code {
  display: block;
  margin-top: 2px;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
}

/* A switch: a checkbox drawn as one, so it keeps its keyboard and its label. */
.switch {
  position: relative;
  width: 34px;
  height: 20px;
  flex: none;
  margin: 0;
  border-radius: var(--radius-full);
  background: var(--line);
  appearance: none;
  cursor: pointer;
  transition: background 200ms ease;
}

.switch::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
  transition: transform 200ms var(--ease);
}

.switch:checked {
  background: var(--teal);
}

.switch:checked::after {
  transform: translateX(14px);
}

.switch:disabled {
  opacity: 0.45;
  cursor: default;
}

.storeys label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 14px;
  cursor: pointer;
}

.storeys input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--teal);
}

.storeys .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storeys .elevation {
  width: 70px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.storeys .count {
  width: 56px;
  color: var(--ink-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.row-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.row-switch label {
  cursor: pointer;
}

.row-switch .muted {
  display: block;
  font-size: 12px;
}

/* Element details: the Model panel's style. */

.drawer-title {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.kicker {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
}

.name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.where {
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 13px;
}

.detail-section {
  padding: 12px 0;
  border-bottom: 1px solid var(--line-3);
  font-size: 13px;
}

.detail-section h3 {
  margin-bottom: 6px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
}

.details .facts {
  grid-template-columns: 110px minmax(0, 1fr);
}

.values {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.w10 {
  width: 10%;
}

.w15 {
  width: 15%;
}

.w20 {
  width: 20%;
}

.w30 {
  width: 30%;
}

.w40 {
  width: 40%;
}

.w45 {
  width: 45%;
}

.w50 {
  width: 50%;
}

.w60 {
  width: 60%;
}

.values th {
  color: var(--ink-3);
  font-weight: 600;
  text-align: left;
}

.values th,
.values td {
  padding: 3px 6px 3px 0;
  border-bottom: 1px solid var(--line-3);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.pset summary {
  padding: 4px 0;
  font-weight: 600;
  cursor: pointer;
}

.pset table {
  margin-bottom: 6px;
}

/* ------------------------------------------------------------------ the "?" explainer */

/* The CV site's project pop-up: a picture hero, a stats row, then the sections. */
.explainer {
  width: min(780px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100% - 48px);
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: var(--radius-dialog);
  background: var(--bg);
  box-shadow: var(--shadow-2xl);
  color: var(--ink);
}

.explainer[open] {
  animation: explainer-in 400ms var(--ease);
}

@keyframes explainer-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(16px);
  }
}

.explainer::backdrop {
  background: rgb(26 31 36 / 0.38);
}

.hero {
  position: relative;
  display: flex;
  min-height: 150px;
  align-items: flex-end;
  overflow: hidden;
  background: #2b3036;
  color: #fff;
}

.hero-picture {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 60% 45%;
}

/* Dark where the text is (white on it: 4.9:1 or more up to 58 %), light over the building. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgb(0 0 0 / 0.8) 0%, rgb(0 0 0 / 0.62) 50%, rgb(0 0 0 / 0.08) 100%);
}

.hero-text {
  position: relative;
  z-index: 1;
  max-width: 58%;
  padding: 24px 0 22px 28px;
}

.hero-text h2 {
  font-size: var(--size-2xl);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 10px rgb(0 0 0 / 0.4);
}

.hero-text p {
  margin-top: 4px;
  font-size: 15px;
  opacity: 0.92;
}

.hero-close {
  position: absolute;
  right: 16px;
  top: 16px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: rgb(255 255 255 / 0.92);
  box-shadow: var(--shadow-lg);
  color: var(--ink-2);
  transition: transform 250ms var(--ease);
}

.hero-close:hover {
  border-color: transparent;
  background: var(--teal);
  color: #fff;
  transform: rotate(90deg);
}

/* On the light side of the picture: its own dark backing, for 5:1. */
.hero-credit {
  position: absolute;
  right: 12px;
  bottom: 8px;
  z-index: 1;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: rgb(0 0 0 / 0.55);
  color: #fff;
  font-size: 11px;
}

.hero-credit a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line-2);
  background: var(--surface-alt);
}

.tab {
  padding: 5px 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
}

.tab:hover {
  background: var(--hover);
  color: var(--ink);
}

.tab[aria-selected="true"] {
  background: var(--teal-08);
  color: var(--teal-ink);
  font-weight: 700;
}

.tab-panel:focus-visible {
  box-shadow: inset var(--ring);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line-2);
  background: var(--surface-alt);
}

.stat {
  padding: 12px 24px;
}

.stat + .stat {
  border-left: 1px solid var(--line-2);
}

.stat b {
  display: block;
  color: var(--teal-ink);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}

.stat span {
  display: block;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.35;
}

.inner {
  padding: 18px 28px 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 20px;
}

.n {
  display: inline-grid;
  width: 26px;
  height: 26px;
  flex: none;
  place-items: center;
  border-radius: var(--radius-full);
  background: var(--teal);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.steps .n {
  display: grid;
  margin-bottom: 6px;
}

.steps b {
  display: block;
  margin-bottom: 2px;
  font-size: 16px;
}

.steps p {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.45;
}

.why {
  margin-bottom: 18px;
}

.why li {
  position: relative;
  margin-bottom: 6px;
  padding-left: 20px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.45;
}

.why li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 7px;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--teal);
}

.why b {
  color: var(--ink);
}

.last-box {
  padding: 14px 16px;
  border: 1px solid var(--line-3);
  border-radius: 12px;
  background: var(--surface);
}

.last-box > p {
  margin-bottom: 12px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.45;
}

.last-box > p b {
  color: var(--ink);
}

.last-box .fine {
  margin-top: -6px;
  color: var(--ink-3);
  font-size: 12px;
}

.last-box .fine:empty {
  display: none;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  display: inline-flex;
  height: 40px;
  align-items: center;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.button:hover {
  border-color: var(--teal-15);
  text-decoration: none;
}

.button.primary {
  border-color: transparent;
  background: var(--teal-gradient);
  box-shadow: 0 6px 14px -6px rgb(14 129 146 / 0.5);
  color: #fff;
}

/* The diagram: three rows, from a Revit export to this page. */

.diagram {
  display: grid;
  grid-template-columns: 1fr 40px 1fr 40px 1fr;
  grid-template-rows: auto 28px auto 30px auto;
}

.node {
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}

.node-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.node-head .n {
  width: 22px;
  height: 22px;
  font-size: 11px;
}

.node-head small {
  margin-left: auto;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.node > p:last-child {
  margin-top: 5px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.4;
}

.n1 { grid-area: 1 / 1; }
.w12 { grid-area: 1 / 2; }
.n2 { grid-area: 1 / 3; }
.w23 { grid-area: 1 / 4; }
.n3 { grid-area: 1 / 5; }
.w34 { grid-area: 2 / 5; }
.n4 { grid-area: 3 / 1 / 4 / 6; }
.w45 { grid-area: 4 / 1; }
.w46 { grid-area: 4 / 3; }
.w47 { grid-area: 4 / 5; }
.n5 { grid-area: 5 / 1; }
.n6 { grid-area: 5 / 3; }
.w67 { grid-area: 5 / 4; }
.n7 { grid-area: 5 / 5; }

.store {
  display: flex;
  align-items: center;
  gap: 12px;
  border-color: var(--teal-15);
  background: var(--teal-08);
  box-shadow: none;
}

.store .node-head {
  flex: none;
  white-space: nowrap;
}

.store .node-head small {
  margin-left: 4px;
  color: var(--teal-ink);
}

.store > p:last-child {
  margin-top: 0;
}

.db {
  width: 24px;
  height: 28px;
  flex: none;
  fill: none;
  stroke: var(--teal);
  stroke-width: 2;
}

.out {
  border-color: var(--teal-15);
}

/* An arrow: a line and its head, in the cell between two steps. */
.wire {
  position: relative;
  color: #8a939d;
}

.wire::before,
.wire::after {
  content: "";
  position: absolute;
}

.wire.right::before {
  left: 4px;
  right: 8px;
  top: calc(50% - 1px);
  height: 2px;
  background: currentColor;
}

.wire.right::after {
  right: 3px;
  top: calc(50% - 5px);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid currentColor;
}

.wire.down::before {
  left: calc(50% - 1px);
  top: 3px;
  bottom: 8px;
  width: 2px;
  background: currentColor;
}

.wire.down::after {
  left: calc(50% - 5px);
  bottom: 2px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid currentColor;
}

/* A two-way arrow: the line leaves room for a second head, at the top. */
.wire.both::before {
  top: 9px;
}

.wire .up {
  position: absolute;
  left: calc(50% - 5px);
  top: 2px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 7px solid currentColor;
}

.wire em {
  position: absolute;
  left: calc(50% + 8px);
  top: 50%;
  transform: translateY(-50%);
  color: var(--teal-ink);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.wire.feed {
  color: var(--teal);
}

.wire.feed::before {
  background: repeating-linear-gradient(to right, currentColor 0 4px, transparent 4px 8px);
}

.key {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--ink-3);
  font-size: 12px;
}

.dash {
  width: 40px;
  height: 2px;
  flex: none;
  background: repeating-linear-gradient(to right, var(--teal) 0 4px, transparent 4px 8px);
}

.follow {
  margin-top: 18px;
  padding: 12px 16px;
  border: 1px solid var(--line-3);
  border-radius: 12px;
  background: var(--surface);
}

.follow h4 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
}

.trail {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.4;
}

.trail p {
  position: relative;
}

.trail p + p::before {
  content: "→";
  position: absolute;
  left: -17px;
  top: 14px;
  color: var(--ink-3);
}

.trail em {
  display: block;
  margin-bottom: 2px;
  color: var(--ink-3);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.trail code {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  font-size: 12px;
}

.trail b {
  color: var(--ink);
  font-weight: 600;
}

.built {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--ink-3);
  font-size: 13px;
}

.tech {
  padding: 3px 10px;
  border: 1px solid var(--line-3);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 600;
}

.built a {
  margin-left: auto;
  font-weight: 700;
}

/* ------------------------------------------------------------------ a phone, a narrow window */

@media (max-width: 759px) {
  :root {
    --gap: 12px;
  }

  /* The model above the sheet, so that it is fitted to what can be seen of it. */
  .canvas,
  body.asking .canvas {
    bottom: var(--sheet-h, 0px);
    transform: none;
  }

  .topbar {
    position: fixed;
    left: 12px;
    right: 12px;
    top: 12px;
    z-index: 9;
    display: flex;
    height: 52px;
    align-items: center;
    gap: 10px;
    padding: 0 8px 0 12px;
    border-radius: var(--radius-full);
    background: rgb(255 255 255 / 0.95);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--line-2);
  }

  .topbar .mark {
    width: 26px;
    height: 26px;
  }

  .topbar .brand-name {
    flex: 1;
  }

  .topbar .fab {
    height: 44px;
    box-shadow: none;
  }

  .topbar .round {
    width: 44px;
    height: 44px;
  }

  .model-open,
  .pill,
  .ask-note,
  .ask-open,
  .panel-head {
    display: none;
  }

  .fit-round {
    position: fixed;
    right: 14px;
    bottom: calc(var(--sheet-h, 260px) + 12px);
    z-index: 8;
    display: grid;
    width: 44px;
    height: 44px;
    color: var(--ink-2);
  }

  .credit,
  body.side-open .credit {
    left: 12px;
    right: auto;
    top: 72px;
    bottom: auto;
    max-width: calc(100% - 24px);
    padding: 2px 10px;
    border-radius: var(--radius-full);
  }

  /* The answer and the box: a sheet at the bottom, the box in thumb reach. */
  .panel,
  body.asking .panel {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: auto;
    height: auto;
    max-height: 62vh;
    border-radius: 18px 18px 0 0;
    box-shadow:
      0 -8px 24px -6px rgb(0 0 0 / 0.14),
      0 0 0 1px var(--line-2);
  }

  .panel.up {
    max-height: 88vh;
  }

  .earlier {
    position: relative;
    display: block;
    flex: none;
    min-height: 44px;
    padding: 18px 16px 4px;
    border: 0;
    background: none;
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 600;
    touch-action: none;
  }

  .earlier::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 8px;
    width: 40px;
    height: 5px;
    transform: translateX(-50%);
    border-radius: var(--radius-full);
    background: var(--line);
  }

  .earlier:empty {
    min-height: 22px;
    padding: 0;
  }

  .history,
  body.asking .history {
    flex: 0 0 auto;
    height: 0;
    padding: 0 16px;
    visibility: hidden;
    opacity: 0;
  }

  .panel.up .history,
  body.asking .panel.up .history {
    height: auto;
    padding: 4px 16px 8px;
    visibility: visible;
    opacity: 1;
  }

  .badge {
    visibility: visible;
    opacity: 1;
  }

  /* No "Next:" on a phone (mockup 1): the model keeps the room; ‹ › and the list stay. */
  .next,
  .next:empty {
    display: none;
  }

  .current,
  body.asking .current {
    padding: 4px 16px 10px 26px;
  }

  .current::before,
  body.asking .current::before {
    top: 6px;
    bottom: 12px;
    opacity: 1;
  }

  .qline {
    font-size: 14px;
  }

  .big {
    margin-top: 6px;
    font-size: 22px;
  }

  .big small {
    font-size: 14px;
  }

  /* Chips, two to a row: 34 px to see, 44 px to touch (8 px apart, 5 px more each side). */
  .legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 6px;
  }

  .legend li {
    max-width: calc(50% - 3px);
  }

  .legend button {
    position: relative;
    width: auto;
    max-width: 100%;
    height: 34px;
    gap: 6px;
    margin: 0;
    padding: 0 10px 0 8px;
    border: 1px solid var(--line-3);
    background: var(--surface);
    font-size: 13px;
  }

  .legend button::after {
    content: "";
    position: absolute;
    inset: -5px 0;
  }

  .legend .sw {
    width: 10px;
    height: 10px;
  }

  .how summary {
    min-height: 44px;
    align-items: center;
    padding-top: 0;
  }

  .composer,
  body.asking .composer {
    height: auto;
    padding: 10px 14px 0;
    overflow: visible;
    border-top-color: var(--line-2);
  }

  .ask,
  body.asking .ask {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
    box-shadow: none;
  }

  .ask::after {
    display: none;
  }

  .ask:focus-within,
  body.asking .ask:focus-within {
    border-color: var(--teal);
    box-shadow: var(--ring);
  }

  .box,
  body.asking .box {
    position: static;
    min-height: 50px;
    opacity: 1;
    visibility: visible;
  }

  .slot {
    display: none;
  }

  .list-toggle,
  .send {
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
  }

  /* Fixed: the sheet is too low to hold the list; main.js says where the box is. */
  .question-list {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: var(--list-bottom, 140px);
    max-height: calc(100vh - var(--list-bottom, 140px) - 76px);
  }

  .options li {
    min-height: 44px;
  }

  .chip,
  .stepper button {
    min-width: 44px;
    min-height: 44px;
  }

  .x {
    width: 44px;
    height: 44px;
  }

  /* The Model panel and the details: sheets too, over the answer. */
  .side {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    z-index: 20;
    width: auto;
    max-height: 82vh;
    border-radius: 18px 18px 0 0;
    animation-name: sheet-in;
  }

  @keyframes sheet-in {
    from {
      transform: translateY(40px);
      opacity: 0;
    }
  }

  .switch {
    width: 44px;
    height: 26px;
  }

  .switch::after {
    width: 22px;
    height: 22px;
  }

  .switch:checked::after {
    transform: translateX(18px);
  }

  .storeys label,
  .disc-row {
    min-height: 44px;
  }

  .storeys input {
    width: 22px;
    height: 22px;
  }

  /* The explainer: a sheet, and its diagram a timeline, 1 to 4, then 5, 6 and 7. */
  .explainer {
    width: 100%;
    max-height: 92vh;
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
  }

  @keyframes explainer-in {
    from {
      transform: translateY(40px);
      opacity: 0;
    }
  }

  .hero {
    min-height: 120px;
  }

  /* The text spans the picture: dark all over, the building still seen on the right. */
  .hero::after {
    background: linear-gradient(to right, rgb(0 0 0 / 0.8), rgb(0 0 0 / 0.6));
  }

  .hero-picture {
    object-position: 78% 50%;
  }

  .hero-text {
    max-width: none;
    padding: 20px 64px 34px 18px;
  }

  .hero-close {
    width: 44px;
    height: 44px;
  }

  .tabs {
    padding: 8px 12px;
  }

  .tab {
    min-height: 44px;
  }

  .stat {
    padding: 10px 12px;
  }

  .stat b {
    font-size: 22px;
  }

  .stat span {
    font-size: 12px;
  }

  .inner {
    padding: 16px 16px 24px;
  }

  .steps,
  .trail {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Each step's number beside its name. */
  .steps .n {
    display: inline-grid;
    margin: 0 8px 0 0;
    vertical-align: 1px;
  }

  .steps b {
    display: inline;
  }

  .steps p {
    margin-top: 4px;
  }

  .trail p + p::before {
    content: none;
  }

  .button {
    min-height: 44px;
  }

  .diagram {
    position: relative;
    display: block;
  }

  .diagram::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 12px;
    bottom: 12px;
    width: 2px;
    background: var(--line-2);
  }

  .diagram .wire {
    display: none;
  }

  .node,
  .store {
    position: relative;
    display: block;
    margin: 0 0 12px;
    padding: 0 0 0 34px;
    border: 0;
    background: none;
    box-shadow: none;
  }

  .node-head .n {
    position: absolute;
    left: 0;
    top: -1px;
    box-shadow: 0 0 0 4px var(--bg);
  }

  .node-head small {
    margin-left: 6px;
  }

  .store > p:last-child,
  .store .node-head {
    padding: 8px 10px 0;
  }

  .store {
    padding: 0 0 8px 0;
    margin-left: 34px;
    border: 1px solid var(--teal-15);
    border-radius: 10px;
    background: var(--teal-08);
  }

  .store .node-head .n {
    left: -34px;
    top: 7px;
  }

  .store .db {
    display: none;
  }

  .n5 .node-head .n,
  .n6 .node-head .n,
  .n7 .node-head .n {
    border: 2px solid var(--teal);
    background: var(--bg);
    color: var(--teal-ink);
  }

  .built a {
    margin-left: 0;
  }
}

/* ------------------------------------------------------------------ calm motion, or none */

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