/* console.css: the two working pages, Data licensing and Book a call (Builder D).
   A console is film on one side and a working panel on the other. It is not a staged scene:
   from 860px wide the film stays put and only the panel scrolls; under 860px the film comes
   first and the page scrolls.
   Tokens and shared classes only. Gaps come from the set 8, 16, 24, 40, 64px. */

/* ---------- 1. The console ---------- */
.console { --film-w: 54%; display: flex; flex-direction: column; min-height: 100svh; }
.console--book { --film-w: 46%; }

.console__film { position: relative; flex: none; height: 46svh; min-height: 240px; background: var(--ink); }
.console__film > .media { position: absolute; inset: 0; }
/* The telephone and its lamp stand in the right third of their film. The booking page shows a
   tall slice of it, so the slice is taken from the right, where they are. */
.console--book .console__film > .media > video { object-position: 92% 50%; }
/* The frame's words lie over the top of the film. The same soft scrim a staged scene has keeps
   them on dark wherever the light is; it fades out downward and has no edge. */
.console__film::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 140px; z-index: 1; pointer-events: none;
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--ink) 86%, transparent) 0,
    color-mix(in srgb, var(--ink) 84%, transparent) 52px,
    color-mix(in srgb, var(--ink) 40%, transparent) 96px,
    transparent 140px);
}

.console__panel { flex: 1 0 auto; padding: 0; }
/* Stacked, the page itself scrolls; the panel's scroller only scrolls from 860px (below). */
.console__scroll { overflow: visible; padding: 40px var(--pad) 64px; }
.console__body { max-width: 36rem; }

/* The frame on a console. While the film is under it, the frame has no footing of its own: its
   words carry the dark halo that words over a picture carry. Stacked, once the film has scrolled
   away (data.js and book.js mark it), the frame stands on the panel's ground. */
html:is([data-page="data"], [data-page="book"]) { --frame-ground: transparent; --frame-shade: var(--shade); }
html.console-past-film { --frame-ground: var(--ledger); --frame-shade: var(--no-shade); }

@media (min-width: 860px) {
  /* Side by side, nothing scrolls behind the frame: the wordmark sits on the film and keeps the
     halo; the links sit on the panel's plain ground and need none. */
  html:is([data-page="data"], [data-page="book"]) { --frame-shade: var(--no-shade); }
  html:is([data-page="data"], [data-page="book"]) .frame__brand { --frame-shade: var(--shade); }
  .console__film { position: fixed; inset: 0 auto 0 0; width: var(--film-w); height: auto; min-height: 0; }
  /* The panel starts under the frame, so its words never pass behind the frame's links. It laps
     the film by one pixel: a percentage width can end between two pixels, and the film's last
     column would otherwise show as a thin lit line down the seam. */
  .console__panel { position: fixed; inset: 0 0 0 calc(var(--film-w) - 1px); padding: var(--frame-h) 0 0; }
  .console__scroll {
    height: 100%; overflow-y: auto;
    padding: 24px var(--pad) 64px;
    /* words leaving the top of the panel dissolve instead of meeting a hard edge */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, black 24px);
    mask-image: linear-gradient(to bottom, transparent 0, black 24px);
  }
}

/* One rhythm for both panels: title, lead, the working part, then the reading blocks. */
.console__lead { margin-top: 16px; }
.console__alt { margin-top: 16px; }
.console__block { margin-top: 64px; }
.console__block > * + * { margin-top: 24px; }
.console__block > .facts + .t-body { margin-top: 16px; }
.console__small { margin-top: 64px; max-width: 60ch; text-wrap: pretty; }
/* The last action on the page, then the small print. */
.console__close { margin-top: 64px; }
.console__close + .console__small { margin-top: 40px; }

/* The rows and lists in core.css are sized for a full-width scene. The panel is one narrow
   column: the name column is shorter, the two lists stack, and in a narrow panel a row's name
   sits above its line. Every text block keeps the same left edge. */
.console__body { container-type: inline-size; }
.console .rows > li { grid-template-columns: minmax(0, 10rem) minmax(0, 1fr); column-gap: 24px; }
.console .lists { grid-template-columns: minmax(0, 1fr); gap: 40px; }
@container (max-width: 460px) {
  .console .rows > li { grid-template-columns: minmax(0, 1fr); }
}

/* Without script: the headline, one sentence and a way on. */
.console-plain { display: grid; gap: 16px; max-width: 62ch; padding: 64px var(--pad); }

/* ---------- 2. Data licensing: the sentence you edit ---------- */
/* The sentence is the page. It is set in the title size, its plain words in the secondary
   colour and the words you can change in full. A choice is a word with a dotted gold underline
   and a small chevron after it (a link has a solid underline and no chevron); the underline
   turns solid when the choice is under the pointer or has the focus. */
.fit { margin-top: 40px; }
.fit__hint { text-wrap: balance; }
.fit__sentence {
  position: relative; margin-top: 8px; max-width: none;
  color: var(--bone-2);
  line-height: max(1.36em, 44px);   /* every line is at least a 44px target for a finger */
  text-wrap: wrap;
}
/* Short choices stay together like one word; a long one may wrap like any other words. A
   hyphenated word and the last word (which carries the chevron) never break. */
.fit__slot { white-space: nowrap; }
.fit__slot--wrap { white-space: normal; }
.fit__nb { white-space: nowrap; }
.fit__word {
  color: var(--bone);
  text-decoration: underline dotted; text-decoration-color: var(--gold);
  text-decoration-thickness: 1px; text-underline-offset: 0.22em;
  transition: text-decoration-color var(--t-ui) ease, text-shadow var(--t-ui) ease;
}
.fit__chev {
  display: inline-block; width: 0.28em; height: 0.28em; margin: 0 0.12em 0 0.3em;
  border: solid currentColor; border-width: 0 1.5px 1.5px 0;
  transform: translateY(-0.34em) rotate(45deg);
  opacity: 0.68;
  transition: opacity var(--t-ui) ease;
}
.fit__slot:hover .fit__word, .fit__select:focus + .fit__word {
  text-decoration-style: solid; text-decoration-color: var(--gold-hi);
}
.fit__slot:hover .fit__word { text-shadow: var(--glow-text); }
.fit__slot:hover .fit__chev, .fit__select:focus + .fit__word .fit__chev { opacity: 1; }
/* The real <select> lies over its word (data.js sizes it to the word's lines). It takes the
   click, the keyboard and the native list; the word under it is what is seen. */
.fit__select {
  position: absolute; left: 0; top: 0; width: 1px; height: 1px;
  margin: 0; padding: 0; border: 0; border-radius: 0;
  appearance: none; -webkit-appearance: none;
  background: transparent; color: inherit; font: inherit;
  opacity: 0; cursor: pointer;
}
.fit__select:focus-visible + .fit__word { outline: 2px solid var(--gold); outline-offset: 3px; }

/* The kinds of records: plain words on one wrapping line. A word you can add carries a small
   plus; a word you have added carries a tick and a gold underline. */
.fit__kinds { --kind-h: 36px; margin-top: 24px; max-width: none; gap: 0 24px; align-items: center; }
.fit__kinds-label { display: inline-flex; align-items: center; min-height: var(--kind-h); }
.fit__kinds label > span {
  display: inline-flex; align-items: center; min-height: var(--kind-h); padding: 0;
  font-size: inherit; line-height: 1.5; border-bottom: 0;
  text-decoration: underline; text-decoration-color: transparent;
  text-decoration-thickness: 1px; text-underline-offset: 6px;
  transition: color var(--t-ui) ease, text-decoration-color var(--t-ui) ease;
}
.fit__kinds label > span::before {
  content: ""; flex: none; width: 0.5em; height: 0.5em; margin-right: 0.4em;
  background:
    linear-gradient(currentColor, currentColor) center / 100% 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) center / 1.5px 100% no-repeat;
}
.fit__kinds input:checked + span { text-decoration-color: var(--gold); }
.fit__kinds input:checked + span::before {
  width: 0.26em; height: 0.5em; margin: 0 0.52em 0.14em 0.12em;
  background: none;
  border: solid currentColor; border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
/* a finger gets 44px on every kind */
@media (pointer: coarse), (max-width: 699.98px) {
  .fit__kinds { --kind-h: 44px; }
}

/* ---------- 3. Data licensing: the grade ---------- */
/* Under 860px the grade follows the sentence in the panel. From 860px the letter, its heading
   and the note stand on the film, beside the sentence, and the panel keeps the next step, the
   reasons and the action (see the end of this section). */
.grade { margin-top: 40px; }
.grade__top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 24px; }
.grade__letter { flex: none; min-width: 0.72em; }   /* the name does not jump when the letter changes */
.grade__next { margin-top: 8px; }
.grade__note { margin-top: 16px; max-width: 60ch; }
.grade__empty { color: var(--bone-2); }
/* The reasons: a gap is marked with a short gold rule and set in full; a strength with a tick. */
.grade__reasons { display: grid; gap: 8px; margin-top: 24px; max-width: 60ch; }
.grade__reason {
  display: grid; grid-template-columns: 24px minmax(0, 1fr);
  font-size: 1.125rem; line-height: 1.5; color: var(--bone-2); text-wrap: pretty;
}
.grade__reason::before { content: ""; align-self: start; }
.grade__reason--gap { color: var(--bone); }
.grade__reason--gap::before { width: 12px; margin-top: 0.75em; border-top: 1px solid var(--gold); }
.grade__reason--good::before {
  width: 5px; height: 10px; margin: 0.36em 0 0 3px;
  border: solid currentColor; border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.grade .actions { margin-top: 24px; }
/* A new letter arrives lit: its warm glow starts bright and settles. The letter itself is at
   full strength from the first frame, so nothing is ever left dim. */
@media (prefers-reduced-motion: no-preference) {
  .grade__top.is-new .grade__letter { animation: grade-lit 1.2s var(--ease); }
}
@keyframes grade-lit { from { text-shadow: 0 0 36px rgb(var(--glow) / 0.9); } }

.grade-film { display: none; }
@media (min-width: 860px) {
  .grade-film {
    display: block; position: absolute; z-index: 2; pointer-events: none;
    left: var(--pad); right: 92px; bottom: 40px;   /* clear of the round pause button */
    max-width: 30rem;
    text-shadow: var(--shade);
  }
  .grade-film .grade__empty { color: var(--bone); }
  .grade-film .grade__letter { text-shadow: var(--glow-text), var(--shade); }
  .grade-film .grade__note { margin-top: 16px; max-width: 24rem; }
  /* A shade rises behind those words from the film's bottom-left corner. It is as tall and as
     wide as the words are, fades out above them and to their right, and stops where the round
     pause button begins: in a narrow or a short window the lit drawer comes under the words,
     and they hold their contrast wherever the lamp is. */
  .grade-film::before {
    content: ""; position: absolute; z-index: -1; pointer-events: none;
    inset: -96px -24px -40px calc(-1 * var(--pad));
    background: linear-gradient(to top,
      color-mix(in srgb, var(--ink) 84%, transparent) 0,
      color-mix(in srgb, var(--ink) 84%, transparent) calc(100% - 96px),
      color-mix(in srgb, var(--ink) 50%, transparent) calc(100% - 56px),
      transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black calc(100% - 48px), transparent 100%);
    mask-image: linear-gradient(to right, black calc(100% - 48px), transparent 100%);
  }
  /* until there is a grade the panel has nothing of its own to show here */
  .console:not([data-grade]) .grade { margin-top: 0; }
  /* The panel's own copies stay for a screen reader and are taken out of sight. */
  .grade .grade__empty, .grade .grade__top, .grade .grade__note {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .grade__next { margin-top: 0; }
  .grade__reasons { margin-top: 16px; }
}

/* ---------- 4. Book a call: the form ---------- */
/* .field (core.css) gives a label above and a bottom rule only. Here: one column, one left
   edge, and room between the rows. */
.bk-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; margin-top: 40px; }
/* the first line of a select that has no answer yet reads as a prompt, not as an answer */
.bk-form select:has(option[value=""]:checked) { color: var(--bone-2); }
.bk-form__note { margin-top: 16px; max-width: 60ch; }
/* a line under one field (the phone consent wording) */
.bk-form .field__note { margin: 8px 0 0; max-width: 60ch; }
.bk-form .btn[aria-disabled="true"] { pointer-events: none; }
/* The spam trap: off the page for people and for the keyboard. */
.bk-form__trap {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
/* The message under the form is in the page from the start (so a screen reader hears it the
   moment words are written into it) and takes no room while it is empty. */
.bk-msg { margin-top: 24px; scroll-margin: 40px; }   /* brought into view with room around it */
.bk-msg:empty { margin-top: 0; }
.bk-msg:focus, .bk-msg:focus-visible { outline: none; }
