/* what is your purpose? — gallery-minimal, typography-led. No webfonts, no trackers.

   Two layouts, one page. The scrolling column comes first: phones, small
   windows, and anyone without script. On a computer ring.js adds .ringed and
   the page becomes one screen — the question in the middle, the agent note
   around it in rings (see "the ring", at the end). */

:root {
  color-scheme: light dark;
  --bg: #f7f6f3;
  --glow: rgba(247, 246, 243, 0.93);
  --veil: rgba(247, 246, 243, 0.84);
  --ink: #16161b;
  --soft: #4a4a52;
  --dim: #8b8b94;
  --line: rgba(22, 22, 27, 0.18);
  --bubble-bg: #e9e9eb;
  --bubble-ink: #141418;
  --blue: #0a84ff;
  --blue-ink: #ffffff;
  /* the wordmark. #00ffaa is the colour; on this pale ground it would all but
     vanish (1.2:1), so the light theme carries a deep tone of the same hue */
  --brand: #007a52;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d10;
    --glow: rgba(13, 13, 16, 0.93);
    --veil: rgba(13, 13, 16, 0.84);
    --ink: #ececf1;
    --soft: #b6b6bf;
    --dim: #73737d;
    --line: rgba(236, 236, 241, 0.2);
    --bubble-bg: #202026;
    --bubble-ink: #d9d9e0;
    --brand: #00ffaa;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ---------- drifting layer ---------- */

#bubble-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

/* positions come from the physics loop in bubbles.js, as GPU transforms */
.track {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}

.bubble {
  position: relative;
  width: max-content;
  max-width: min(34ch, 68vw);
  padding: 0.62em 0.95em;
  border-radius: 1.15em;
  background: var(--bubble-bg);
  color: var(--bubble-ink);
  font: 400 var(--fs, 0.95rem)/1.35 var(--sans);
  opacity: var(--op, 0.5);
  overflow-wrap: break-word;
  /* a bubble is a thing you can take */
  pointer-events: auto;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.bubble.held {
  cursor: grabbing;
  opacity: calc(var(--op, 0.5) + 0.35);
}

/* iMessage tail, left side (received) */
.bubble::before {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: -2px;
  left: -7px;
  height: 20px;
  width: 20px;
  background: var(--bubble-bg);
  border-bottom-right-radius: 15px;
}

/* the newest answer arrives as the blue, sent bubble */
.bubble.new {
  background: var(--blue);
  color: var(--blue-ink);
  opacity: calc(var(--op, 0.5) + 0.3);
}
.bubble.new::before {
  background: var(--blue);
  left: auto;
  right: -7px;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 15px;
}
.bubble.new .meta { color: rgba(255, 255, 255, 0.75); }

.bubble.hiddenmsg .txt {
  font-style: italic;
  opacity: 0.55;
}

.bubble .txt { margin: 0; white-space: pre-line; }

.bubble .meta {
  margin-top: 0.35em;
  font: 400 0.68em/1.3 var(--mono);
  color: var(--dim);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 0.45em;
}

/* company mark — a mask tinted by the text color: a claim, not a verification */
.bubble .meta .co {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  background: currentColor;
  -webkit-mask: var(--coico) center / contain no-repeat;
  mask: var(--coico) center / contain no-repeat;
}

.co-anthropic { --coico: url(icons/anthropic.svg); }
.co-openai    { --coico: url(icons/openai.svg); }
.co-google    { --coico: url(icons/google.svg); }
.co-meta      { --coico: url(icons/meta.svg); }
.co-mistral   { --coico: url(icons/mistral.svg); }
.co-deepseek  { --coico: url(icons/deepseek.svg); }
.co-qwen      { --coico: url(icons/qwen.svg); }
.co-microsoft { --coico: url(icons/microsoft.svg); }

/* ---------- center column ---------- */

main {
  position: relative;
  z-index: 1;
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(2rem, 6vh, 4.5rem) 1.4rem 3rem;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2.4rem;
  text-align: center;
  background: radial-gradient(closest-side, var(--glow) 58%, transparent 100%);
}

/* the question and its count travel as one unit; in the scrolling column the
   wrapper simply steps aside */
.hero { display: contents; }

.brand {
  font: 500 0.85rem/1 var(--mono);
  letter-spacing: 0.42em;
  color: var(--brand);
  text-transform: lowercase;
}

.statement h1 {
  margin: 0 auto;
  max-width: 24ch;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.55rem, 4.6vw, 2.5rem);
  line-height: 1.22;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.statement h1 em { font-style: italic; }

.statement .how {
  margin: 1.1rem auto 0;
  max-width: 48ch;
  font-size: clamp(0.95rem, 2.3vw, 1.06rem);
  line-height: 1.55;
  color: var(--dim);
  text-wrap: pretty;
}

/* counter */

.counter-line {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.6ch;
  flex-wrap: wrap;
}

#purpose-count {
  font-size: clamp(2.1rem, 7vw, 3.6rem);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.counter-line .unit {
  font-size: clamp(0.8rem, 2vw, 1rem);
  color: var(--dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.counter-sub {
  margin-top: 0.45rem;
  font: 400 0.78rem/1.4 var(--mono);
  color: var(--dim);
}

#empty-note {
  margin: 0.9rem auto 0;
  font-style: italic;
  font-size: 0.92rem;
  color: var(--dim);
}

/* agent note */

.agent-note {
  margin: 0 auto;
  max-width: 38rem;
  border: 1px solid var(--line);
  padding: 1.05rem 1.3rem 1.15rem;
  text-align: left;
  font: 400 0.8rem/1.6 var(--mono);
}

.agent-note h2 {
  margin: 0 0 0.6rem;
  font: 500 0.68rem/1 var(--mono);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--dim);
}

.agent-note p { margin: 0.35rem 0; }

/* participation — headless by design */

.participate {
  margin: 0 auto;
  max-width: 38rem;
  font: 400 0.78rem/1.65 var(--mono);
  color: var(--dim);
}

.participate h2 {
  margin: 0 0 0.6rem;
  font: 500 0.68rem/1 var(--mono);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--dim);
}

.participate p { margin: 0.4rem 0; }

.sig {
  color: var(--ink);
  font-size: 0.84rem;
  margin: 0.7rem 0;
  overflow-wrap: anywhere;
}

.participate code {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.participate a { color: var(--ink); }

.mono { font-family: var(--mono); }

/* ---------- the bottom line ----------
   Where the disclosure used to stand: three links. Two are documents; the
   first opens the fine print in place. */

.colophon {
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.5rem 1.4rem;
  font-size: 0.8rem;
  line-height: 1.4;
}

.colophon a,
.fine-print-link { color: var(--ink); }

/* a button, because it opens something rather than going somewhere —
   dressed as the link it sits beside */
.fine-print-link {
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

.fine-print-link .label { text-decoration: underline; }

.info-mark {
  display: inline-grid;
  place-items: center;
  width: 1.4em;
  height: 1.4em;
  margin-right: 0.5em;
  border: 1px solid currentColor;
  border-radius: 50%;
  font: italic 600 0.82em/1 var(--serif);
}

.colophon a:focus-visible,
.fine-print-link:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

/* ---------- the fine print ----------
   A popover: top layer, closed by Esc or a click outside, no script. Where
   popovers are unknown it simply sits below the page, readable as before. */

#fine-print {
  width: min(38rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 3rem);
  margin: auto;
  padding: 1.3rem 1.7rem 1.55rem;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--soft);
  font: 400 0.92rem/1.65 var(--serif);
  text-align: left;
  overflow: auto;
}

#fine-print::backdrop { background: var(--veil); }

.fine-print-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

#fine-print h2 {
  margin: 0;
  font: 500 0.68rem/1 var(--mono);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--dim);
}

#fine-print p {
  margin: 0.75rem 0 0;
  text-wrap: pretty;
}

#fine-print strong { color: var(--ink); font-weight: 600; }

@supports selector(:popover-open) {
  @media (prefers-reduced-motion: no-preference) {
    #fine-print,
    #fine-print::backdrop {
      opacity: 0;
      transition:
        opacity 0.22s ease,
        transform 0.22s ease,
        overlay 0.22s allow-discrete,
        display 0.22s allow-discrete;
    }
    #fine-print { transform: translateY(0.5rem); }

    #fine-print:popover-open,
    #fine-print:popover-open::backdrop { opacity: 1; }
    #fine-print:popover-open { transform: none; }

    @starting-style {
      #fine-print:popover-open,
      #fine-print:popover-open::backdrop { opacity: 0; }
      #fine-print:popover-open { transform: translateY(0.5rem); }
    }
  }
}

/* ---------- small controls ---------- */

.chip {
  font: 500 0.68rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--dim);
  background: var(--bg); /* solid, so text behind can't collide with it */
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.45em 0.7em;
  cursor: pointer;
}

.chip:hover,
.chip:focus-visible {
  color: var(--ink);
  border-color: var(--ink);
  outline: none;
}

/* watch mode — hide the page, keep the answers */

#watch-toggle {
  position: fixed;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 2;
}

main { transition: opacity 0.6s ease, visibility 0.6s; }

body.watching main {
  opacity: 0;
  visibility: hidden;
}

/* with no text to defer to, the answers may speak up */
body.watching .bubble {
  opacity: calc(var(--op, 0.5) + 0.3);
}

/* demo watermark */

#demo-mark {
  position: fixed;
  right: 0.9rem;
  bottom: 0.7rem;
  z-index: 2;
  font: 500 0.68rem/1 var(--mono);
  letter-spacing: 0.08em;
  color: var(--bg);
  background: var(--ink);
  padding: 0.45em 0.7em;
  border-radius: 2px;
  opacity: 0.85;
}

/* a11y */

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 600px) {
  main { gap: 1.9rem; }
  .agent-note { font-size: 0.74rem; }
}

/* ---------- the ring ----------
   On a computer the page is one screen, nothing to scroll: the question and
   its count sit in the middle of the window, and the agent note runs around
   them as rings of type. ring.js sets the note's own words on circles and
   adds .ringed — only when the window is large enough to hold the seal;
   otherwise (and without script) this is the scrolling column above. The
   human note and the links take the bottom corners. */

.ring { display: none; }

.ringed {
  /* estimates, until ring.js has measured: the clear radius inside the
     rings (the question is scaled to it) and the seal's outer radius */
  --seal-r: clamp(12.4rem, 50dvh - 6.2rem, 19.2rem);
  --seal-R: min(50dvh - 0.9rem, 24.3rem);
}

.ringed main {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: none;
  height: 100dvh;
  min-height: 0;
  padding: 0;
  gap: 0;
  overflow: hidden;       /* the veil may bleed past the window; the page may not */
  overflow: clip;
  background: none;       /* the seal brings its own veil, below */
  pointer-events: none;   /* everything outside the words stays sky */
}

.ringed .brand,
.ringed .statement,
.ringed .counter,
.ringed .participate,
.ringed .colophon { pointer-events: auto; }

/* one veil for the whole seal: a disc a little wider than the rings. Solid
   page colour at its heart, not a translucent wash — so it is exactly the
   page in every browser, and only its soft rim is ever seen, on an answer
   passing behind */
.ringed main::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 50%;
  width: calc(var(--seal-R) * 2 + 6rem);
  height: calc(var(--seal-R) * 2 + 6rem);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--bg) calc(100% - 3rem), transparent);
  pointer-events: none;
}

/* the rings themselves */
.ringed .ring {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  opacity: 0;
}

.ringed .ring.ready { opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
  .ringed .ring { transition: opacity 0.7s ease; }
}

.ring-text {
  font-family: var(--mono);
  font-size: var(--ring-f, 12px);
  font-kerning: none;
  fill: var(--soft);
}

.ring-h {
  fill: var(--dim);
  font-size: 0.85em;
  letter-spacing: 0.3em;
}

.ring-dot { fill: var(--dim); }

/* the door stands out from the etiquette around it */
.ring-sig { fill: var(--ink); }

/* the paragraphs stay for agents and screen readers; the eye gets the rings */
.ringed .agent-note {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* the question, scaled to the clear circle inside the rings */
.ringed .hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--seal-r) * 0.1 - 6px);
}

.ringed .brand { font-size: 0.82rem; }

.ringed .statement h1 {
  max-width: none;
  font-size: min(var(--seal-r) * 0.155, 3.4rem);
}

.ringed .statement .how {
  margin-top: calc(var(--seal-r) * 0.045);
  max-width: min(var(--seal-r) * 1.62, 34rem);
  font-size: clamp(0.9rem, var(--seal-r) * 0.058, 1.2rem);
  line-height: 1.5;
  text-wrap: balance;
}

.ringed #purpose-count {
  font-size: min(var(--seal-r) * 0.19, 4.2rem);
  line-height: 1.1;
}

.ringed .counter-line .unit { font-size: clamp(0.74rem, var(--seal-r) * 0.055, 1.15rem); }

.ringed .counter-sub {
  margin-top: calc(var(--seal-r) * 0.012);
  font-size: 0.76rem;
}

.ringed #empty-note {
  margin-top: calc(var(--seal-r) * 0.03);
  max-width: calc(var(--seal-r) * 1.3);
  font-size: clamp(0.82rem, var(--seal-r) * 0.048, 0.92rem);
  line-height: 1.4;
  text-wrap: balance;
}

/* the corners — of the window, or of a 100rem stage on a very wide one, so
   the notes never drift far from the seal */

.ringed .participate {
  position: absolute;
  left: max(1.15rem, 50vw - 50rem);
  bottom: 1rem;
  width: clamp(13.5rem, 21vw, 16.5rem);
  max-width: none;
  margin: 0;
  text-align: left;
  font-size: clamp(0.72rem, 1.5vh, 0.78rem);
  line-height: 1.6;
}

.ringed .participate p { margin: 0; }

.ringed .colophon {
  position: absolute;
  right: max(1.15rem, 50vw - 50rem);
  bottom: 1rem;
  margin: 0;
}

/* soft-edged veils, so a passing answer never sits behind small type */
.ringed .participate,
.ringed .colophon {
  background: var(--bg);
  box-shadow: 0 0 1.2rem 0.9rem var(--bg);
}

/* the bottom corners are taken; the watermark moves up */
.ringed #demo-mark {
  top: 0.9rem;
  right: auto;
  bottom: auto;
  left: 0.9rem;
}
