/*
 * The component library's stylesheet. Served by Workers Static Assets, so it
 * reaches the browser without running the Worker.
 *
 * Structure: fonts, then tokens, then grounds, then one section per component
 * in src/ui/. Variants are data attributes that mirror the typed props one to
 * one, so `<Chip lead size="sm">` is `.chip[data-lead][data-size="sm"]` here.
 *
 * Rules that test/ui/tokens.spec.ts enforces on this file:
 *   - :root and the ground blocks match src/ui/tokens.ts exactly.
 *   - `color:` outside :root and the ground blocks uses a role, never a
 *     palette colour, so the ground decides what it resolves to.
 *   - a class coloured `var(--numeral)` never sets a font-size under 24px.
 */

/* Fonts --------------------------------------------------------------------
 * Self-hosted from @fontsource 5.3.0, OFL-1.1; licences in /fonts. Latin only,
 * except Instrument Sans, which also carries latin-ext because it sets the
 * writer's own words.
 */

@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/barlow-condensed-latin-600-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;
}

@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/fonts/barlow-condensed-latin-700-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;
}

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/instrument-sans-latin-400-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;
}

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/instrument-sans-latin-ext-400-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: "Instrument Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/instrument-sans-latin-500-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;
}

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/instrument-sans-latin-ext-500-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: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/jetbrains-mono-latin-400-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;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/jetbrains-mono-latin-500-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;
}

/* Tokens ------------------------------------------------------------------- */

:root {
  --paper: #F2EFE6;
  --paper-raised: #FBFAF6;
  --paper-sunk: #E7E3D7;
  --ink: #15140F;
  --ink-on-dark: #F2EFE6;
  --muted: #615C4F;
  --muted-on-dark: #B5AE9D;
  --rule: #D8D3C4;
  --rule-strong: #C6C0AE;
  --vermillion: #CE3B1E;
  --vermillion-ink: #A82E14;
  --ink-soft: #3C382E;
  --faint-on-dark: #9A9384;
  --rule-on-dark: #4A463B;
  --tick: #B4AE9C;
  --needle-previous: #6F6A5B;
  --vermillion-on-dark: #E4553A;
  --vermillion-faint: #D7664E;

  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  /* 22px on a 390 phone, 64px at 1280, as the design files have them. */
  --gutter: clamp(22px, 5vw, 64px);
}

/* Grounds ------------------------------------------------------------------ */

[data-ground="paper"] {
  --background: var(--paper);
  --text: var(--ink);
  --text-soft: var(--ink-soft);
  --text-muted: var(--muted);
  --text-accent: var(--vermillion-ink);
  --on-accent: var(--paper-raised);
  --line: var(--rule);
  --line-strong: var(--rule-strong);
  --edge: var(--ink);
  --tick-mark: var(--tick);
  --numeral: var(--vermillion);
  --numeral-faint: var(--vermillion-faint);
}

[data-ground="sunk"] {
  --background: var(--paper-sunk);
  --text: var(--ink);
  --text-soft: var(--ink-soft);
  --text-muted: var(--muted);
  --text-accent: var(--vermillion-ink);
  --on-accent: var(--paper-raised);
  --line: var(--rule);
  --line-strong: var(--rule-strong);
  --edge: var(--ink);
  --tick-mark: var(--tick);
  --numeral: var(--vermillion);
  --numeral-faint: var(--vermillion);
}

[data-ground="ink"] {
  --background: var(--ink);
  --text: var(--ink-on-dark);
  --text-soft: var(--muted-on-dark);
  --text-muted: var(--faint-on-dark);
  --text-accent: var(--vermillion-on-dark);
  --on-accent: var(--paper-raised);
  --line: var(--rule-on-dark);
  --line-strong: var(--rule-on-dark);
  --edge: var(--rule-on-dark);
  --tick-mark: var(--rule-on-dark);
  --numeral: var(--vermillion);
  --numeral-faint: var(--vermillion);
}

[data-ground] {
  background: var(--background);
  color: var(--text);
}

/* Base --------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
figure,
blockquote {
  margin: 0;
}

a {
  color: var(--text-accent);
}

a:hover {
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--vermillion);
  outline-offset: 2px;
}

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

/* Layout ------------------------------------------------------------------- */

.container {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container[data-measure="page"] {
  max-width: 1280px;
}

/* The support, refusal and error screens are designed at 390 wide and stay a
 * phone-width column on any screen. They are read once and never linked to, so
 * a single calm column is the whole intent. */
.container[data-measure="phone"] {
  max-width: 440px;
  padding-inline: 22px;
}

/* The result screen, ticket 39. Phone-width up to 720, then a wider column
 * holding the two-column composition below. `/r/<id>` is where a shared
 * receipt is opened, so a desktop reader is not an edge case. */
.container[data-measure="receipt"] {
  max-width: 440px;
  padding-inline: 22px;
}

@media (min-width: 720px) {
  .container[data-measure="receipt"] {
    max-width: 1040px;
    padding-inline: var(--gutter);
  }
}

.section[data-space="sm"] {
  padding-block-start: clamp(24px, 3.2vw, 40px);
}

.section[data-space="md"] {
  padding-block-start: clamp(40px, 6vw, 78px);
}

.section[data-space="lg"] {
  padding-block-start: clamp(48px, 7.2vw, 92px);
}

.section[data-last] {
  padding-block-end: clamp(32px, 3.4vw, 44px);
}

.box {
  flex-shrink: 0;
}

.box[data-width="44"] { width: 44px; }
.box[data-width="52"] { width: 52px; }
.box[data-width="360"] { width: 360px; max-width: 100%; }

.divider {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.stack {
  display: flex;
  flex-direction: column;
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.cluster[data-wrap="no"] {
  flex-wrap: nowrap;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 720px) {
  .grid[data-columns="2"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid[data-columns="3"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

[data-align="start"] { align-items: flex-start; }
[data-align="center"] { align-items: center; }
[data-align="end"] { align-items: flex-end; }
[data-align="baseline"] { align-items: baseline; }
[data-align="stretch"] { align-items: stretch; }

[data-justify="start"] { justify-content: flex-start; }
[data-justify="center"] { justify-content: center; }
[data-justify="end"] { justify-content: flex-end; }
[data-justify="between"] { justify-content: space-between; }

[data-gap="4"] { gap: 4px; }
[data-gap="8"] { gap: 8px; }
[data-gap="12"] { gap: 12px; }
[data-gap="16"] { gap: 16px; }
[data-gap="20"] { gap: 20px; }
[data-gap="24"] { gap: 24px; }
[data-gap="32"] { gap: 32px; }
[data-gap="40"] { gap: 40px; }
[data-gap="48"] { gap: 48px; }
[data-gap="64"] { gap: 64px; }

[data-grow] {
  flex-grow: 1;
  min-width: 0;
}

/* In a row that wraps, a growing child shares the line until it would be
 * narrower than 320px, then takes a line of its own: the wall's featured
 * slots beside their numeral on a desktop, above it on a phone. */
.cluster > [data-grow] {
  flex: 1 1 320px;
}

[data-push="end"] {
  margin-top: auto;
}

/* Rows separated by hairlines: the scale, the live strip, the mirror counts. */

.ruled {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.ruled__row {
  display: flex;
  border-bottom: 1px solid var(--line);
}

.ruled__row[data-pad="sm"] { padding-block: 9px; }
.ruled__row[data-pad="md"] { padding-block: 12px; }
.ruled__row[data-pad="lg"] { padding-block: 15px; }

/* Type --------------------------------------------------------------------- */

.label {
  font-family: var(--font-mono);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.label[data-size="10"] { font-size: 10px; }
.label[data-size="11"] { font-size: 11px; }
.label[data-size="12"] { font-size: 12px; }
.label[data-tracking="wide"] { letter-spacing: 0.18em; }
.label[data-tone="text"] { color: var(--text); }
.label[data-tone="accent"] { color: var(--text-accent); }

/* A line of mono readout that is not a label: "confidence 0.88 · work". */
.meta {
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.meta[data-size="11"] { font-size: 11px; }
.meta[data-size="12"] { font-size: 12px; }

.display {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1;
  color: var(--text);
}

.display[data-size="118"] {
  font-size: clamp(56px, 9.2vw, 118px);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.015em;
}

.display[data-size="86"] {
  font-size: clamp(48px, 6.7vw, 86px);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.015em;
  /* "On 17 September the internet was a / 1.9." leaves the number alone on
   * a line. Balanced lines keep it with the words before it. */
  text-wrap: balance;
}

.display[data-size="60"] {
  font-size: clamp(38px, 4.7vw, 60px);
  letter-spacing: -0.01em;
}

.display[data-measure="narrow"] { max-width: 900px; }
.display[data-size="50"] { font-size: 50px; }
.display[data-size="42"] { font-size: 42px; }
.display[data-size="34"] { font-size: 34px; }
.display[data-size="25"] { font-size: 25px; line-height: 1.05; }

.text {
  font-family: var(--font-body);
  color: var(--text);
}

.text[data-size="13"] { font-size: 13px; line-height: 1.5; }
.text[data-size="14"] { font-size: 14px; line-height: 1.5; }
.text[data-size="15"] { font-size: 15px; line-height: 1.6; }
.text[data-size="16"] { font-size: 16px; line-height: 1.55; }
.text[data-size="17"] { font-size: 17px; line-height: 1.6; }
.text[data-size="19"] { font-size: 19px; line-height: 1.4; }
.text[data-size="21"] { font-size: 21px; line-height: 1.5; }
.text[data-tone="soft"] { color: var(--text-soft); }
.text[data-tone="muted"] { color: var(--text-muted); }
.text[data-align="center"] { text-align: center; }
.text[data-measure="narrow"] { max-width: 610px; }
.text[data-measure="wide"] { max-width: 820px; }

.worry {
  font-family: var(--font-body);
  color: var(--text);
  overflow-wrap: anywhere;
}

.worry[data-size="17"] { font-size: 17px; line-height: 1.4; }
.worry[data-size="20"] { font-size: 20px; line-height: 1.35; }
.worry[data-size="22"] { font-size: 22px; line-height: 1.35; }
.worry[data-size="30"] { font-size: clamp(22px, 2.4vw, 30px); line-height: 1.3; }
.worry[data-size="46"] { font-size: 46px; line-height: 1.22; letter-spacing: -0.01em; }
.worry[data-size="62"] { font-size: 62px; line-height: 1.2; letter-spacing: -0.012em; }

/* Numerals ----------------------------------------------------------------- */

.numeral {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--numeral);
  white-space: nowrap;
}

.numeral[data-confidence="low"] {
  color: var(--numeral-faint);
}

.numeral[data-size="26"] { font-size: 26px; }
.numeral[data-size="34"] { font-size: 34px; }
.numeral[data-size="52"] { font-size: 52px; line-height: 0.8; }
.numeral[data-size="62"] { font-size: 62px; line-height: 0.76; }
.numeral[data-size="132"] { font-size: 132px; line-height: 0.76; letter-spacing: -0.03em; }
.numeral[data-size="148"] { font-size: 148px; line-height: 0.77; letter-spacing: -0.03em; }
.numeral[data-size="258"] { font-size: 258px; line-height: 0.74; letter-spacing: -0.035em; }
.numeral[data-size="404"] { font-size: 404px; line-height: 0.74; letter-spacing: -0.035em; }

/* Needle ------------------------------------------------------------------- *
 * Absolutely positioned divs on a percentage of the 0 to 5 axis, not SVG.
 * `--at`, `--from` and `--to` are unitless 0-100 values set inline by
 * src/ui/needle.tsx. Positions run over (100% - width) so a mark at 0 or 5
 * sits flush with the end of the axis instead of hanging over it.
 */

.needle {
  position: relative;
  width: 100%;
  height: var(--box);
}

.needle[data-size="md"] {
  --box: 58px;
  --needle-y: 0px;
  --needle-h: 36px;
  --needle-w: 3px;
  --axis-y: 30px;
  --tick-y: 24px;
  --tick-h: 13px;
  --tick-w: 1px;
}

.needle[data-size="lg"] {
  --box: 54px;
  --needle-y: 6px;
  --needle-h: 38px;
  --needle-w: 4px;
  --axis-y: 26px;
  --tick-y: 20px;
  --tick-h: 14px;
  --tick-w: 1px;
}

.needle[data-size="card"] {
  --box: 36px;
  --needle-y: 0px;
  --needle-h: 34px;
  --needle-w: 6px;
  --axis-y: 17px;
  --tick-y: 10px;
  --tick-h: 16px;
  --tick-w: 2px;
}

.needle[data-size="og"] {
  --box: 30px;
  --needle-y: 0px;
  --needle-h: 28px;
  --needle-w: 4px;
  --axis-y: 14px;
  --tick-y: 8px;
  --tick-h: 13px;
  --tick-w: 1px;
}

.needle__band,
.needle__axis,
.needle__tick,
.needle__mark,
.needle__previous,
.needle__label {
  position: absolute;
}

.needle__band {
  top: calc(var(--needle-y) + 4px);
  height: calc(var(--axis-y) - var(--needle-y) - 4px);
  left: calc(var(--from) * 1%);
  width: calc((var(--to) - var(--from)) * 1%);
  background: color-mix(in srgb, var(--vermillion) 15%, transparent);
}

[data-ground="ink"] .needle__band {
  background: color-mix(in srgb, var(--vermillion) 28%, transparent);
}

.needle__axis {
  left: 0;
  right: 0;
  top: var(--axis-y);
  height: 2px;
  background: var(--edge);
}

.needle__tick {
  top: var(--tick-y);
  width: var(--tick-w);
  height: var(--tick-h);
  background: var(--tick-mark);
  left: calc(var(--at) * (100% - var(--tick-w)) / 100);
}

.needle__tick:nth-child(1) { --at: 0; }
.needle__tick:nth-child(2) { --at: 20; }
.needle__tick:nth-child(3) { --at: 40; }
.needle__tick:nth-child(4) { --at: 60; }
.needle__tick:nth-child(5) { --at: 80; }
.needle__tick:nth-child(6) { --at: 100; }

.needle__ticks {
  position: absolute;
  inset: 0;
}

.needle__previous {
  top: calc(var(--needle-y) + 4px);
  width: 2px;
  height: calc(var(--needle-h) - 8px);
  background: var(--needle-previous);
  left: calc(var(--at) * (100% - 2px) / 100);
}

.needle__mark {
  top: var(--needle-y);
  width: var(--needle-w);
  height: var(--needle-h);
  background: var(--vermillion);
  left: calc(var(--at) * (100% - var(--needle-w)) / 100);
}

.needle__label {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  color: var(--text-muted);
  white-space: nowrap;
}

.needle__label[data-role="value"] {
  top: calc(var(--needle-y) + var(--needle-h) + 8px);
  left: calc(var(--at) * 1%);
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text);
}

.needle__label[data-role="previous"] {
  top: -6px;
  left: calc(var(--at) * 1%);
  transform: translateX(-50%);
  letter-spacing: 0.08em;
}

.needle__label[data-role="start"],
.needle__label[data-role="end"] {
  top: calc(var(--axis-y) + 12px);
}

.needle__label[data-role="start"] { left: 0; }
.needle__label[data-role="end"] { right: 0; }

/* Chips -------------------------------------------------------------------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: block;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  white-space: nowrap;
}

.chip[data-lead] {
  border-color: var(--vermillion);
  background: var(--vermillion);
  color: var(--on-accent);
}

.chips[data-size="sm"] .chip {
  padding: 8px 13px;
  letter-spacing: 0;
}

.chips[data-size="og"] {
  gap: 9px;
}

.chips[data-size="og"] .chip {
  padding: 10px 16px;
  font-size: 14px;
}

.chips[data-size="card"] {
  gap: 12px;
}

.chips[data-size="card"] .chip {
  padding: 14px 22px;
  border-width: 2px;
  font-size: 19px;
  letter-spacing: 0.04em;
}

/* On a card the outline is ink, not a hairline: it is read as a still image,
 * often small, and a 1.9:1 outline disappears. */
.chips[data-size="og"] .chip:not([data-lead]),
.chips[data-size="card"] .chip:not([data-lead]) {
  border-color: var(--edge);
  color: var(--text);
}

/* Buttons ------------------------------------------------------------------ */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--edge);
  border-radius: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.button[data-size="sm"] {
  height: 48px;
  padding-inline: 18px;
  border-width: 1px;
  font-size: 11px;
  letter-spacing: 0.1em;
}

.button[data-size="md"] {
  height: 54px;
  padding-inline: 24px;
}

.button[data-size="lg"] {
  height: 68px;
  padding-inline: 34px;
}

.button[data-variant="solid"] {
  border-color: var(--text);
  background: var(--text);
  color: var(--background);
}

.button[data-variant="accent"] {
  border-color: var(--vermillion);
  background: var(--vermillion);
  color: var(--on-accent);
}

.button[data-variant="outline"]:hover {
  border-color: var(--text);
}

/* A share button that has just done something, filled for a moment by
 * /share.js. The same signal the `same` button gives, and it says it without
 * a word, so no button ever changes its label. */
.button[data-done] {
  border-color: var(--vermillion);
  background: var(--vermillion);
  color: var(--on-accent);
}

.button[data-width="full"] {
  width: 100%;
}

.button[data-width="grow"] {
  flex: 1 1 0;
  min-width: 0;
}

.same {
  flex-shrink: 0;
  height: 44px;
  padding-inline: 16px;
  border: 1px solid var(--edge);
  border-radius: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.same[aria-pressed="true"] {
  border-color: var(--vermillion);
  background: var(--vermillion);
  color: var(--on-accent);
}

/* With the space before it, 0.75em from the word, as the design has it. */
.same__count {
  margin-left: 0.15em;
  font-variant-numeric: tabular-nums;
}

.same[aria-busy="true"] {
  cursor: progress;
}

/* Made by /same.js only when a press needs a Turnstile token: a line of its
 * own under the button, where the widget appears if it asks for anything. */
.same-check {
  flex-basis: 100%;
}

.same-check:empty {
  display: none;
}

/* Fields ------------------------------------------------------------------- */

.field__row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.field[data-size="lg"] .field__row {
  gap: 12px;
}

/* The input carries data-ground="paper" itself: its ground is always raised
 * paper, so its text must resolve to ink even inside an ink panel. */
.field__input {
  flex-grow: 1;
  min-width: 0;
  height: 48px;
  padding-inline: 14px;
  border: 2px solid var(--edge);
  border-radius: 0;
  background: var(--paper-raised);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
}

.field[data-size="lg"] .field__input {
  height: 68px;
  padding-inline: 24px;
  font-size: 19px;
}

.field__input::placeholder {
  color: var(--text-muted);
}

.field__label {
  display: block;
  margin-bottom: 10px;
}

/* The landing's ask box stops at 760px, where the design's does. */
.ask-form[data-size="lg"] {
  max-width: 760px;
}

/* On a phone the landing's 68px button would leave the input about 160px, so
 * the button goes under it, full width. */
@media (max-width: 719px) {
  .field[data-size="lg"] .field__row {
    flex-direction: column;
  }
}

/* While an ask is in flight, /ask.js marks the form busy (ticket 36). The wait
 * is real — the Jev call alone is 200-300 ms — and the browser's tab indicator
 * is close to invisible on a phone.
 *
 * It says nothing. A sentence here would be a thirteenth cell of copy, and the
 * state is over in under a second. It dims, it stops taking presses, and the
 * cursor says the rest. No colour is declared, so the two grounds need no
 * separate rule. */
.ask-form[aria-busy="true"] {
  cursor: progress;
}

.ask-form[aria-busy="true"] .field,
.ask-form[aria-busy="true"] .button {
  pointer-events: none;
  animation: ask-waiting 1.1s ease-in-out infinite alternate;
}

@keyframes ask-waiting {
  from {
    opacity: 0.5;
  }
  to {
    opacity: 0.85;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ask-form[aria-busy="true"] .field,
  .ask-form[aria-busy="true"] .button {
    animation: none;
    opacity: 0.6;
  }
}

/* Panels ------------------------------------------------------------------- *
 * A column, so a child marked `grow` fills the panel's height: the wall's
 * slots line their bottom rows up across a grid row that way.
 */

.panel {
  display: flex;
  flex-direction: column;
}

.panel[data-tone="outline"] {
  border: 1px solid var(--line-strong);
}

.panel[data-tone="outline-strong"] {
  border: 2px solid var(--edge);
}

.panel[data-pad="xs"] { padding: 14px 16px; }
.panel[data-pad="md"] { padding: 26px 28px; }
.panel[data-pad="lg"] { padding: clamp(24px, 3vw, 32px) clamp(20px, 3vw, 36px); }
.panel[data-pad="xl"] { padding: clamp(28px, 3.4vw, 40px) clamp(22px, 3.6vw, 44px) clamp(28px, 3.6vw, 44px); }

/* Barometer ---------------------------------------------------------------- */

.barometer[data-layout="inline"] {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px 48px;
}

.barometer[data-layout="inline"] .barometer__text {
  flex: 1 1 420px;
}

.barometer[data-layout="inline"] .barometer__needle {
  flex: 0 1 360px;
}

.barometer[data-layout="hero"] .barometer__needle {
  margin-top: 30px;
  margin-bottom: 22px;
}

/* A day with no number has no needle to hold the detail line off the
 * headline. */
.barometer[data-layout="hero"] > .stack + .text {
  margin-top: 30px;
}

/* Site header -------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
}

.site-header__brand {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text);
}

.site-header[data-measure="phone"] .site-header__inner,
.site-header[data-measure="receipt"] .site-header__inner {
  min-height: 52px;
}

.site-header[data-measure="phone"] .site-header__brand,
.site-header[data-measure="receipt"] .site-header__brand {
  font-size: 11px;
}

/* The receipt ------------------------------------------------------------- */

/* One column on a phone, in the order the design draws it: the worry, the
 * number, the needle, the judgment, then what to do next.
 *
 * From 720 it becomes the composition the share card already uses, which is
 * the only wide arrangement of these parts the project has agreed on: the
 * worry and its judgment on the left, the number and its needle on the right,
 * and everything that is an action across the bottom. The areas do the
 * rearranging, so the markup keeps the phone's reading order. */
.receipt {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 720px) {
  .receipt {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    grid-template-areas:
      "said     size"
      "judgment needle"
      "rest     .";
    column-gap: 56px;
    align-items: start;
  }

  .receipt__said { grid-area: said; }
  .receipt__size { grid-area: size; }
  .receipt__needle { grid-area: needle; }
  .receipt__judgment { grid-area: judgment; }
  .receipt__rest { grid-area: rest; }

  /* The worry is the subject of the page, and at phone size it is lost in a
   * column this wide. It grows with the viewport to the size the wall gives a
   * worry, and no further. */
  .receipt__said .worry[data-size="20"] {
    font-size: clamp(20px, 2.1vw, 30px);
    line-height: 1.3;
  }

  /* The needle reads as the number's, not as the page's, so it stops at the
   * width of the column holding the number. */
  .receipt__needle { align-self: start; }

  /* The actions stay in the column the worry is in. Across both columns a
   * 1040px "Share the receipt" is a black bar the width of the page, which is
   * not what a 390-wide design's full-width button means. */
  .receipt__rest { padding-block-start: 8px; }
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
}

.site-nav[data-size="11"] {
  gap: 26px;
}

.site-nav__link {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-muted);
}

.site-nav[data-size="11"] .site-nav__link {
  font-size: 11px;
}

.site-nav__link[aria-current="page"] {
  color: var(--text);
}

@media (max-width: 719px) {
  .site-header__inner {
    min-height: 52px;
  }

  .site-nav {
    gap: 20px;
  }

  .site-header__brand,
  .site-nav__link {
    font-size: 11px;
  }
}

/* Card --------------------------------------------------------------------- *
 * Fixed pixel sizes. A card is a picture of a receipt, screenshotted at
 * exactly this size, so nothing here responds to the viewport.
 */

.card {
  width: 1080px;
  height: 1350px;
  padding: 36px;
}

.card[data-format="og"] {
  width: 1200px;
  height: 630px;
  padding: 22px;
}

.card__frame {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 56px;
  border: 2px solid var(--edge);
}

.card[data-format="og"] .card__frame {
  padding: 40px 44px;
}

.card__masthead,
.card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.card__masthead {
  font-size: 17px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.card[data-format="og"] .card__masthead {
  font-size: 12px;
}

.card__brand {
  color: var(--text);
}

.card__body {
  display: flex;
  flex-grow: 1;
  flex-direction: column;
  padding-top: 44px;
}

.card[data-format="og"] .card__body {
  padding-top: 18px;
}

.card__footer {
  margin-top: 34px;
  padding-top: 24px;
  border-top: 2px solid var(--line-strong);
  font-size: 18px;
  letter-spacing: 0.08em;
}

.card__footer > :first-child {
  color: var(--text);
}

.card[data-format="og"] .card__footer {
  margin-top: 0;
  padding-top: 18px;
  border-top-width: 1px;
  font-size: 13px;
  letter-spacing: 0.1em;
}

.card[data-format="og"] .card__footer > :first-child {
  color: var(--text-muted);
}
