/*
 * Tokens. The only stylesheet that may contain a raw colour or a raw length.
 * Everything else refers to what is declared here, so stage mode is one
 * change: a root size that follows the window, as a slide does.
 */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url("./fonts/space-grotesk-latin-wght-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url("./fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations");
}

:root {
  color-scheme: dark;
  font-size: 16px;

  /* Ground and ink. */
  --canvas: #0a0a0a;
  --canvas-deep: #060606;
  --panel: rgb(255 255 255 / 0.02);
  --panel-2: rgb(255 255 255 / 0.035);
  --panel-3: rgb(255 255 255 / 0.055);
  --ink-bright: #ffffff;
  --ink: #e0e0e0;
  --ink-2: #b4b4b4;
  --ink-dim: #999999;
  --ink-muted: #808080;
  --line-hair: #141414;
  --line: #1a1a1a;
  --line-quiet: #232323;
  --line-mid: #333333;
  --line-strong: #555555;
  --dot: #1c1c1c;

  /* Verdicts. Used for nothing else. */
  --granted: #00ff88;
  --granted-dim: rgb(0 255 136 / 0.14);
  --granted-wash: rgb(0 255 136 / 0.06);
  --narrowed: #ffb340;
  --narrowed-dim: rgb(255 179 64 / 0.14);
  --narrowed-faint: rgb(255 179 64 / 0.06);
  --refused: #ff0040;
  /* Low enough that the refused word set on it keeps 4.5 to 1. At 0.14 it measured 4.45. */
  --refused-dim: rgb(255 0 64 / 0.07);
  --refused-edge: rgb(255 0 64 / 0.45);
  /* Waiting on a person. Used for nothing else. */
  --waiting: #ffb340;
  /* The light that crosses the one button when it is ready. */
  --shine: rgb(255 255 255 / 0.75);

  /* The lens. Brand light, as on kya.id: it says where to look, and it never says what was decided. */
  --lens-a: #3b6cff;
  --lens-b: #ff2d8a;
  --lens-ink: #8aa4ff;
  --lens-line: linear-gradient(90deg, var(--lens-a), var(--lens-b));
  --spot: radial-gradient(closest-side, rgb(59 108 255 / 0.3), rgb(110 70 255 / 0.1) 58%, transparent);
  /* A request, crossing: a white point with the lens round it, and the way it has just come. */
  --glint: 0 0 0.55rem 0.1rem rgb(150 170 255 / 0.95), 0 0 1.5rem 0.35rem rgb(255 45 138 / 0.4);
  --trail-lens: linear-gradient(to left, rgb(190 200 255 / 0.85), rgb(255 45 138 / 0.35) 55%, transparent);
  /* A live credential stands lit. A revoked one is lit in the colour of the no. */
  --bloom: rgb(255 255 255 / 0.4);
  --bloom-refused: rgb(255 0 64 / 0.55);
  /* A signer's colour, as light: white, with a hint of it. How much of it there is in a credential's line, frame and
     mark; in the glow round them; and in a person's emblem, lit. */
  --hint: 22%;
  --hint-glow: 55%;
  --hint-emblem: 30%;
  /* The film over the whole page, as on kya.id. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url%28%23n%29'/%3E%3C/svg%3E");
  --grain-amount: 0.035;
  /* A surface's top edge catches the light, as a machined edge does: a hair of white just inside it. */
  --edge-light: rgb(255 255 255 / 0.06);
  /* The one button: a face lit from above, a darker hair along its foot, and a little of its light on the ground under it. */
  --btn-face: linear-gradient(180deg, #ffffff, #e4e4e4);
  --btn-face-hover: linear-gradient(180deg, #ffffff, #f2f2f2);
  --btn-edge: inset 0 -1px 0 rgb(0 0 0 / 0.22), 0 0 0 1px rgb(255 255 255 / 0.1);
  --btn-glow: 0 0.75rem 1.75rem -1rem rgb(255 255 255 / 0.32);
  /* A card on the graph: a little light falls down its face from its top edge, and, pointed at, a soft light follows the
     pointer over it. White light only: neither says that anything happened. */
  --card-sheen: linear-gradient(180deg, rgb(255 255 255 / 0.03), transparent 60%);
  --card-spot: rgb(255 255 255 / 0.07);
  /* What a long press has filled of the button so far. */
  --btn-held: rgb(0 0 0 / 0.14);
  --mast-glass: rgb(10 10 10 / 0.72);
  --mast-blur: 14px;

  --sans: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  /* Space. */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.25rem;
  --s6: 1.5rem;
  --s7: 2.25rem;
  --s8: 3rem;
  --s9: 4.5rem;
  --s10: 6rem;
  --page: 80rem;
  --side: clamp(1rem, 4vw, 3rem);
  --mast-h: 4rem;
  --hair: 1px;
  --rule: 2px;
  --mark: 0.375rem;
  --grid: 2.5rem;
  --dot-size: 1px;
  --dot-edge: 1.2px;
  --radius: 0;

  /* Heights that never change with state, so nothing above a list moves. Set from measurement. */
  --view-h: 27rem;
  /* Room for the button, its line, and three whole rows of what was done. */
  --actions-h: 22rem;
  /* The part of the actions panel that holds the button and its line. As tall with a button as without one. */
  --actions-now-h: 8.5rem;
  --list-h: 18rem;
  --keys-h: 15rem;
  /* The graph on the conductor: its columns, the room a credential's words take between two parties, and its marks. */
  --page-wide: 100rem;
  /* The first screen: as tall as the window, and no taller than a stage needs. On a projector the graph keeps a little
     air under it, and its key keeps some, over it once a step is on show. */
  --hero-max: 66rem;
  --hero-foot: 0rem;
  --legend-gap: 0rem;
  --legend-over: var(--legend-gap);
  /* The room round a step's words: over its small type, between it, its name and its claim, and under the claim; then
     between a place's name and its cards. A window too short for all of it at these sizes sets them closer. */
  --story-air: var(--s4);
  --story-gap: var(--s4);
  --story-foot: var(--s5);
  --region-gap: var(--s3);
  /* A step's name is the largest thing on the screen, and follows the window's width alone: a shorter window never
     makes it smaller. The graph makes its room from what is around the words, never from the words. */
  --type-story: clamp(3rem, 6.2vw, 7.5rem);
  /* The showing's own title, which is longer, on two lines at most. */
  --type-cover: clamp(2.5rem, 4.4vw, 5.75rem);
  /* The closing lines, and a chapter under the graph. A chapter's name is never larger than a step's. */
  --type-finale: clamp(1.875rem, min(8.6vw, 9vh), 7rem);
  --type-chapter: clamp(2.5rem, 5.4vw, 5.25rem);
  /* The service's answer: one word, read from the back of a room. */
  --type-answer: clamp(1.75rem, 2.9vw, 2.75rem);
  /* A party's name on its card: what is read first there. */
  /* It follows the width of a card, so the longest word of the usual names fits beside its emblem: a little smaller in
     the narrowest columns, and larger as the columns widen. */
  --type-card: clamp(0.75rem, max(min(3vw - 0.85rem, 0.9375rem), 3.11vw - 1.625rem), 1.3125rem);
  --track-brand: -0.03em;
  --chapter-gap: clamp(6.875rem, 16vh, 11.875rem);
  --chapter-head-gap: clamp(2.5rem, 6vh, 4.5rem);
  --chapter-head-w: 58.75rem;
  --eyebrow-rule: 17.5rem;
  /* The lens: never larger than this, and never taller than the step it stands beside. It stands out past the column's
     right edge, into the page's side, and the step's words keep a gap clear of the largest it can be. */
  --orb-size: min(23rem, 28vw);
  --orb-size-phone: 13rem;
  --orb-out: 2.5rem;
  --orb-inset: var(--s3);
  --lens-room: calc(var(--orb-size) - var(--orb-out) + var(--s6));
  --claim-w: 34rem;
  /* A step's claim beside the lens: each of its sentences on a line of its own wherever the room allows. The opening
     says more, and takes the width the lens leaves it. */
  --story-claim-w: 48rem;
  --story-open-w: 62rem;
  --cover-w: 60rem;
  --brand-mark-w: 1.25rem;
  --brand-mark-h: 1.4375rem;
  --brand-word: 1.1875rem;
  --brand-bit: 0.375rem;
  --chip-h: 2.125rem;
  /* The one control: one size at every step, whatever the step is called. On a phone it says its word with no key cap,
     and leaves what came of a part the wider share of the bar. */
  --go-w: 11rem;
  --go-w-phone: 7.5rem;
  --go-h: 2.75rem;
  --spot-w: 38rem;
  --spot-h: 21rem;
  /* Room for a step's tick, there before it is, so the line of steps does not shift when one lands. */
  --stepper-tick: 0.75rem;
  /* What moves as a chapter comes in, and how far. */
  --rise: 0.875rem;
  --reveal: 1.125rem;
  /* The closing, with the Vouched lockup at its foot. */
  --vouched-h: 2.5rem;
  --finale-by-w: 35rem;
  /* The transport's least width. It grows to keep a longer name on one line, while the agent's way down beside it
     stays clear of what the credential above it carries: that ends at the agent's edge, then the way down stands a
     space off the transport, with a space either side of it. */
  --flow-gate: 11rem;
  /* The gap between two columns of the graph: as wide as it was made where five columns have the room, and narrower
     with the window, down to half that where the graph becomes a list. */
  --flow-gap: clamp(2rem, 5.93vw - 1.333rem, 4rem);
  --flow-link: 13rem;
  /* Between the agent's column and the intruder's, two gaps, where the second one keeps whoever is outside apart. The two
     answers either side lean into that room alike, so a row of what was tried stays on one line, and the hairline between
     them stands in its middle, as far from the words on either side. */
  --flow-apart: calc(var(--flow-gap) * 2);
  --flow-lean: calc(var(--flow-gap) * 0.7);
  --flow-gate-clear: calc(var(--s4) + var(--s3));
  /* The room under the chain, and the first row of the service's strip, as tall empty as full: nothing on the graph moves
     as it fills. The room under the chain holds the most the last credential ever carries: five lines here, more where
     its column is narrower and its lines wrap. Each step below is set a little wider than the width at which a line
     wraps. The strip's first row holds the place to read and the tallest answer ever drawn beside it. */
  --flow-band: 8.5rem;
  --flow-bar: 9.75rem;
  --flow-mark: 0.5rem;
  /* How long a credential lasts, under its line: a numeral read from the back of a room, smaller than an answer. Under
     it, a bar as thick as this, on a track as long as the longest credential in the chain lasts. */
  --type-measure: clamp(1.5rem, 2.2vw, 2rem);
  --flow-span: 0.375rem;
  /* Fine print on the graph, under the chain and in the rows under an answer, set closer than a paragraph's: a line each
     where the column has room, and only as far apart as the band and the strip allow. */
  --flow-leading: 1.35;
  /* One more line of a row: what the strip keeps, from the start, for each row that may take two lines at a width. */
  --flow-row-line: calc(var(--type-fine) * var(--flow-leading));
  --flow-row-gap: var(--s1);
  --flow-trail: 3.5rem;
  --trail: rgb(255 255 255 / 0.45);
  /* What is done inside a card: the corners that close on the card (on its outer edge, as thick as its frame), and the
     size of the credential's mark before what a card says it holds. */
  --corner: calc(-1 * var(--hair));
  --corner-width: calc(var(--rule) + var(--hair));
  --mark: 0.6rem;
  /* The one place to read, in the middle of the service's strip: a line saying what it is, two lines of what comes next
     or what is happening, set large enough for the back of a room, and the control beside what came of it. On a phone
     it is a bar at the foot of the screen, and says it a size down. */
  --type-place: 1.75rem;
  --type-place-phone: 1.25rem;
  --place-leading: 1.15;
  /* The bar a phone holds the place in is as tall as its rows, their gaps, its padding and its rule: the page keeps
     exactly that clear at its foot. */
  --place-phone-h: calc(var(--s3) * 2 + var(--hair) + var(--type-fine) * 1.4 + var(--s1) * 2 + var(--type-place-phone) * var(--place-leading) * 2 + var(--go-h));
  --log-at: 4.5rem;
  --log-outcome: 22rem;
  /* What a request was, before what came of it: room for the longest on one line at a laptop's width. */
  --log-said: 50rem;
  --recipe-h: 24rem;
  /* A person's own page, as the phone it would be on: one device, laid out in its own points at one size, and drawn
     larger or smaller whole. Its screen is a phone's, 390 by 844 points; the page in it starts under the status bar.
     The bezel's corners are the screen's, grown by the bezel, so the two curves run side by side. */
  --phone-screen-w: 390px;
  --phone-screen-h: 844px;
  --phone-bezel: 12px;
  --phone-w: calc(var(--phone-screen-w) + 2 * var(--phone-bezel));
  --phone-h: calc(var(--phone-screen-h) + 2 * var(--phone-bezel));
  --phone-screen-radius: 47px;
  --phone-radius: calc(var(--phone-screen-radius) + var(--phone-bezel));
  --phone-shell: linear-gradient(145deg, #2a2a2a, #121212);
  --phone-shadow: inset 0 0 0 1px #3a3a3a, 0 40px 80px rgb(0 0 0 / 0.55);
  --phone-status: 54px;
  --phone-icons-w: 44px;
  --phone-icons-h: 12px;
  --phone-island: #000;
  --phone-island-w: 124px;
  --phone-island-h: 36px;
  /* The home indicator: a short bar at the screen's foot, over the page, as the phone itself draws it. */
  --phone-home: rgb(255 255 255 / 0.8);
  --phone-home-w: 134px;
  --phone-home-h: 5px;
  --phone-home-foot: 8px;
  /* The phone's screen behind its sheet: near black, lit faintly from where its clock is. Not a verdict colour. */
  --phone-wall: #050608;
  --phone-glow-light: rgb(64 84 128 / 0.32);
  /* Its shape is drawn again round a phone's page, under the band above it, in components.css: the two go together. */
  --phone-glow: radial-gradient(90% 55% at 50% 22%, var(--phone-glow-light), transparent 70%);
  /* The page on the phone's screen starts under its status bar. */
  --phone-page-h: calc(var(--phone-screen-h) - var(--phone-status));
  --phone-clock: 4.25rem;
  /* The foot of a phone's screen is round, and its home indicator stands there. What the page puts at its foot stays
     clear of both, as a phone's own safe area keeps it. */
  --phone-safe: 34px;
  --sheet-radius: 1.25rem;
  --sheet-shadow: 0 -0.75rem 2.5rem rgb(0 0 0 / 0.55);
  /* The width of a term's name on the sheet a phone shows: "Take back" on one line. */
  --ask-term: 5.5rem;
  --scrim: rgb(0 0 0 / 0.74);
  --scrim-blur: 14px;
  --drawer-w: min(40rem, 100vw);

  /* Type. */
  /* It grows with the page from a phone's width, so a party's own page in a sheet beside the graph has its say at the size of
     the sheet, and stops where a laptop's two columns would. */
  --type-headline: clamp(1.875rem, 6vw, 3.75rem);
  --type-title: clamp(1.25rem, 1.8vw, 1.5rem);
  --type-lead: clamp(1.0625rem, 1.35vw, 1.22rem);
  --type-body: 1.0625rem;
  --type-fine: 0.845rem;
  --type-code: 0.78rem;
  --type-label: 0.72rem;
  /* A record's whole path, which is long, in whatever a column leaves it, and never under the smallest size the system has. */
  --type-path: clamp(var(--type-label), 0.875vw, var(--type-code));
  /* What a card says it holds, sized to the room on its own card: the longest of it fits on one line, from the smallest
     size the system has up to the fine print's. The second term is that room, less what does not grow with the words. */
  --type-state: clamp(var(--type-label), 8.33cqi - 0.28rem, var(--type-fine));
  /* The outcome at the foot of a view: read from the back of a room. */
  --type-verdict: clamp(1.25rem, 2.2vw, 2rem);
  --track-act: -0.045em;
  --track-headline: -0.04em;
  --track-title: -0.02em;
  --track-label: 0.14em;
  /* A hair closer, so a record's whole path still fits the narrowest column on a laptop. */
  --track-path: -0.01em;

  /* Controls. */
  --control-h: 3rem;
  --control-tab-h: 2.875rem;
  --control-field-h: 2.625rem;
  --control-type: 0.9375rem;
  --control-tab-type: 0.75rem;
  /* A party's emblem at the head of its own page. On a card its drawing is as tall as its name's capitals. */
  --emblem: 1.5rem;
  /* A step's mark on the line of what a party has done. */
  --tick: 0.4375rem;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  /* Something landing: it overshoots a little, and settles. */
  --ease-pop: cubic-bezier(0.34, 1.4, 0.64, 1);
  /* Something leaving: it starts slowly and is gone at speed. */
  --ease-in: cubic-bezier(0.55, 0, 0.85, 0.35);
  /* A request crossing a line: it gathers speed gently, and spends its last stretch arriving. */
  --ease-travel: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stage mode: one change. A page on a projector is a slide, 96 by 54 of its own rem: the root follows the window, so
   1280 by 720 and 1920 by 1080 show the same composition, at 13.3px and 20px. Nothing renders under 14px at 1920 by
   1080. The masthead gives back a little of what the slide takes, so the whole graph stands above the fold. A step's
   name is set in the slide's rem, as wide a share of it as a laptop's window gives, so a window of another shape shows
   the same slide. What the slide has to spare goes under the graph and over its key, not all over the step, and a
   window taller than the slide shows the slide whole at its top, as a window of the slide's own shape does. */
:root {
  --slide-w: 96;
  --slide-h: 54;
}

:root[data-stage] {
  --mast-h: 3.5rem;
  --hero-max: calc(var(--slide-h) * 1rem - var(--mast-h));
  --type-story: calc(var(--slide-w) * 0.062rem);
  --hero-foot: var(--s6);
  --legend-gap: var(--s3);
  font-size: min(calc(100vw / var(--slide-w)), calc(100vh / var(--slide-h)));
}

/* The opening's words take all a slide has to spare, and more: its key keeps the air under it, above the slide's foot,
   and the air goes over it as the first step comes on show. */
:root[data-stage]:has(.story__title--cover) {
  --legend-over: 0rem;
}

/* A laptop's window too short for a step's words and the whole graph at their usual room: the words stand a little
   closer, at the same size, so every answer stays above the fold. */
@media (width > 53.75em) and (height <= 52em) {
  :root:not([data-stage]) {
    --story-air: var(--s3);
    --story-gap: var(--s3);
    --story-foot: var(--s3);
    --region-gap: var(--s2);
  }
}

/* A page framed in another is not the slide: it keeps the size a 1920 by 1080 projector gives. */
:root[data-stage]:is([data-frame], [data-conduct]) {
  font-size: 20px;
}

/* Narrower than these, what the last credential carries takes one more line each time: its time, what its issuer
   would not do, and what it carries break in turn. The room under the chain keeps that many lines from the start. */
@media (max-width: 78em) {
  :root:not([data-stage]) {
    --flow-band: 9.75rem;
  }
}

@media (max-width: 68.5em) {
  :root:not([data-stage]) {
    --flow-band: 11rem;
  }
}

@media (max-width: 57.75em) {
  :root:not([data-stage]) {
    --flow-band: 12.25rem;
  }
}

/* Where the graph is a list, every card is as wide as the page: a name is set at its least usual size. */
@media (max-width: 53.75em) {
  :root {
    --type-card: 0.9375rem;
  }
}

@media (max-width: 37.5em) {
  :root {
    --type-body: 1rem;
  }
}
