/* ---------- the intro: what the app does, on the first start and with /welcome ---------- */
/* In the look of the tinker.click site, whatever the app's theme: its colours, its type and its easing. */

@font-face { font-family: "Anton"; src: url("../fonts/Anton-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Geist"; src: url("../fonts/Geist-wght.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }

#intro {
  --bg: #eee9e2;
  --bg-raised: #e5dfd6;
  --ink: #121212;
  --ink-2: #4b4842;
  --muted: #8b867d;
  --line: rgba(18, 18, 18, 0.14);
  --on-ink: #eee9e2;
  --node-1: #2b4dff;
  --node-3: #f2541b;
  --node-4: #0f9f72;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.7, 0, 0.2, 1);
  --display: "Anton", Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  --body: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(16px, 3vw, 40px);
  position: fixed;
  inset: 0;
  z-index: 2000;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  animation: intro-fade 0.25s both;
}
@media (prefers-color-scheme: dark) {
  #intro {
    --bg: #0e0e0f;
    --bg-raised: #171718;
    --ink: #eee9e2;
    --ink-2: #b3aea6;
    --muted: #77736c;
    --line: rgba(238, 233, 226, 0.14);
    --on-ink: #0e0e0f;
    --node-1: #7590ff;
    --node-3: #ff8a5c;
    --node-4: #3fd3a0;
  }
}
#intro.out { opacity: 0; pointer-events: none; transition: opacity 0.35s; }

.intro-orb { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }

.intro-open, .intro-lens, .intro-ticker, .intro-live, .intro-end { position: absolute; inset: 0; visibility: hidden; opacity: 0; transition: opacity 0.35s, visibility 0s 0.35s; }
#intro[data-scene="open"] .intro-open, #intro[data-scene="lens"] .intro-lens, #intro[data-scene="ticker"] .intro-ticker,
#intro[data-scene="live"] .intro-live, #intro[data-scene="end"] .intro-end { visibility: visible; opacity: 1; transition: opacity 0.35s; }
#intro[data-scene="end"] .intro-skip { display: none; }

.intro-live, .intro-end { z-index: 2; }

/* 1. The words rise from behind a line, and fall back. */
.intro-open .rule { position: absolute; left: var(--gutter); top: 62%; height: 4px; width: 0; background: var(--ink); }
#intro[data-scene="open"] .intro-open .rule { width: calc(100% - 2 * var(--gutter)); transition: width 0.875s var(--ease-in-out); }
.intro-open .stack { position: absolute; left: var(--gutter); right: var(--gutter); top: 0; height: 62%; overflow: hidden; }
.intro-open .stack span {
  position: absolute;
  left: 0;
  bottom: 18px;
  font-family: var(--display);
  font-size: min(20vw, 46vh);
  line-height: 0.84;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translateY(calc(100% + 1em));
}
#intro[data-scene="open"] .stack span { animation: intro-rise 0.75s var(--d) both; }

/* 2. Three lines through the lens: inside the circle they are in colour, letter on letter with the rest. */
.intro-lens { --r: 30vmin; --size: min(17vw, 34vh); }
.intro-lens > div { position: absolute; inset: 0; }
.intro-lens b {
  position: absolute;
  left: 50%;
  top: 50%;
  font-size: var(--size);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
}
.intro-lens .plain { -webkit-mask-image: radial-gradient(circle var(--r) at 50% 50%, transparent 99%, #000 100%); mask-image: radial-gradient(circle var(--r) at 50% 50%, transparent 99%, #000 100%); }
.intro-lens .glass { clip-path: circle(var(--r) at 50% 50%); }
.intro-lens .glass b { color: var(--c); }

/* 3. The kinds of app, in two rows sliding opposite ways. */
.intro-ticker { display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.intro-ticker .row { display: flex; width: max-content; }
.intro-ticker .row span {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding-right: 0.4em;
  font-family: var(--display);
  font-size: min(14vw, 26vh);
  line-height: 1.05;
  text-transform: uppercase;
  white-space: nowrap;
}
.intro-ticker .row i { flex: none; width: 0.16em; height: 0.16em; border-radius: 50%; background: var(--muted); }
.intro-ticker .hollow span { color: var(--bg); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
.intro-ticker .hollow i { -webkit-text-stroke: 0; }
#intro[data-scene="ticker"] .row { animation: intro-roll-left 6.25s linear both; }
#intro[data-scene="ticker"] .hollow { animation-name: intro-roll-right; }

/* 4. The request and the app: a tall panel with the current step under it, at any window width. */
/* Inside the panel everything is measured in --u, a hundredth of the card's width, so it all scales together. */
.intro-live { display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; gap: clamp(12px, 2.4vh, 24px); padding: clamp(16px, 3vh, 32px) var(--gutter) 40px; }
.intro-live .stage {
  --k: 1.38;
  --ch: 134;
  --u: calc(84cqw / 100);
  --ph: calc(var(--u) * 11 * var(--k));
  position: relative;
  container-type: size;
  aspect-ratio: 5 / 6;
  width: min(100%, max(220px, calc((100vh - 240px) * 5 / 6)));
  margin-inline: auto;
  overflow: hidden;
  border-radius: 20px;
  background: radial-gradient(110% 80% at 50% 0%, color-mix(in srgb, var(--glow, var(--node-1)) 14%, var(--bg-raised)), var(--bg-raised) 70%);
  perspective: 1100px;
}
.intro-live[data-step="2"] { --glow: var(--node-3); }
.intro-live[data-step="3"] { --glow: var(--node-4); }

.intro-live .card {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  translate: -50% 40%;
  width: min(calc(var(--u) * 108), 92cqw);
  height: calc(var(--ph) + var(--u) * 8);
  border-radius: calc(var(--ph) / 2 + var(--u) * 4);
  background: #fff;
  color: #141414;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 34px 64px -30px rgba(20, 20, 50, 0.4);
  transform-style: preserve-3d;
  transition: width 0.9s var(--ease), height 0.9s var(--ease), border-radius 0.9s var(--ease), translate 0.9s var(--ease), scale 0.9s var(--ease);
}
.intro-live.built .card { width: calc(var(--u) * 100); height: calc(var(--u) * var(--ch)); border-radius: calc(var(--u) * 6); translate: -50% -50%; animation: intro-tilt 1.7s var(--ease) both; }
.intro-live.shared .card { scale: 0.7; translate: -50% -56%; }
@media (prefers-color-scheme: dark) {
  .intro-live .card { background: #1c1c20; color: #f2efe9; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 34px 64px -30px #000; }
}

.intro-live .body { position: absolute; left: calc(var(--u) * 6); top: calc(var(--u) * 6); width: calc(var(--u) * 88); height: calc(var(--u) * (var(--ch) - 16) - var(--ph)); display: flex; flex-direction: column; gap: calc(var(--u) * 3.5); opacity: 0; transform-style: preserve-3d; }
.intro-live.built .body { opacity: 1; transition: opacity 0.4s 0.15s; }
.intro-live .card svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.intro-live .head { display: flex; justify-content: space-between; align-items: flex-start; gap: calc(var(--u) * 3); flex: none; }
.intro-live .head small, .intro-live .tile small { display: block; font: 500 max(8.5px, calc(var(--u) * 2.3 * var(--k))) / 1.3 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.55; }
.intro-live .head strong { display: block; margin-top: calc(var(--u) * 1.2); font: 400 calc(var(--u) * 7.6 * var(--k)) / 1.05 var(--display); letter-spacing: 0.005em; text-transform: uppercase; }
.intro-live .badge { flex: none; padding: calc(var(--u) * 1) calc(var(--u) * 2.4); border-radius: 999px; background: var(--node-3); color: #fff; font-size: calc(var(--u) * 2.3 * var(--k)); font-weight: 600; letter-spacing: 0.06em; transition: background-color 0.3s; }
.intro-live .badge:empty { display: none; }
.intro-live.shared .badge { background: var(--node-4); animation: intro-pop 0.4s var(--ease); }

.intro-live .seg { display: grid; grid-template-columns: 1fr 1fr; flex: none; height: calc(var(--u) * 8.5 * var(--k)); padding: calc(var(--u) * 1); border-radius: 999px; background: rgba(127, 127, 127, 0.12); }
.intro-live .seg span { display: flex; align-items: center; justify-content: center; gap: calc(var(--u) * 1.6); border-radius: 999px; color: #8a857d; font-size: max(8.5px, calc(var(--u) * 2.4 * var(--k))); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; }
.intro-live .seg .on { background: #fff; color: #141414; box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.2); }
.intro-live .seg svg { flex: none; width: calc(var(--u) * 3 * var(--k)); height: calc(var(--u) * 3 * var(--k)); }
@media (prefers-color-scheme: dark) { .intro-live .seg .on { background: #3a3a3f; color: #f2efe9; } }

.intro-live .tiles { flex: 1; min-height: 0; display: grid; grid-template: 1fr 1fr / 1fr 1fr; gap: calc(var(--u) * 3.5); transform-style: preserve-3d; }
.intro-live .tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 1);
  min-height: 0;
  padding: calc(var(--u) * 3.2) calc(var(--u) * 4);
  border-radius: calc(var(--u) * 4.5);
  color: #fff;
  background: linear-gradient(155deg, color-mix(in srgb, var(--t) 82%, #fff), var(--t) 70%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 12px 24px -14px var(--t);
}
.intro-live.built .tile { animation: intro-lift 1.7s var(--ease) both; }
.intro-live .tile > svg { box-sizing: content-box; flex: none; width: calc(var(--u) * 4.4 * var(--k)); height: calc(var(--u) * 4.4 * var(--k)); margin-bottom: auto; padding: calc(var(--u) * 0.9); border-radius: calc(var(--u) * 1.8); background: rgba(255, 255, 255, 0.2); fill: rgba(255, 255, 255, 0.25); }
.intro-live .tile small { flex: none; opacity: 0.8; }
.intro-live .tile > b { flex: none; font: 400 calc(var(--u) * 7.4) / 1.05 var(--display); font-variant-numeric: tabular-nums; }
.intro-live .tile u { display: block; flex: none; height: calc(var(--u) * 1.1); margin-top: calc(var(--u) * 1.2); border-radius: 999px; background: rgba(255, 255, 255, 0.25); overflow: hidden; }
.intro-live .tile u i { display: block; height: 100%; background: #fff; transform: scaleX(0); transform-origin: left; }
.intro-live.built .tile u i { transform: scaleX(var(--v)); transition: transform 1.4s var(--ease) 0.6s; }
.intro-live .cat > b { position: relative; align-self: flex-start; line-height: 1; }
.intro-live .hat { position: absolute; left: 50%; top: -0.34em; font-size: 0.62em; opacity: 0; transform: translate(-50%, -8em); }
.intro-live.hatted .hat { opacity: 1; transform: translate(-50%, 0) rotate(-6deg); transition: transform 0.75s cubic-bezier(0.3, 1.8, 0.5, 1), opacity 0.1s; }

.intro-live .prompt { position: absolute; left: calc(var(--u) * 4); right: calc(var(--u) * 4); bottom: calc(var(--u) * 4); height: var(--ph); display: flex; align-items: center; gap: calc(var(--u) * 2); padding: 0 calc(var(--u) * 1.6) 0 calc(var(--u) * 3.6); border-radius: 999px; font-size: calc(var(--u) * 3.2 * var(--k)); white-space: nowrap; transition: left 0.9s var(--ease), right 0.9s var(--ease), bottom 0.9s var(--ease), background-color 0.4s; }
.intro-live.built .prompt { left: calc(var(--u) * 6); right: calc(var(--u) * 6); bottom: calc(var(--u) * 6); background: rgba(127, 127, 127, 0.12); }
.intro-live .prompt > svg { flex: none; width: calc(var(--u) * 3.6 * var(--k)); height: calc(var(--u) * 3.6 * var(--k)); color: var(--glow, var(--node-1)); }
.intro-live .typed { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.intro-live .caret { flex: none; width: 1.5px; height: 1.1em; margin-left: -1px; background: currentColor; animation: intro-blink 1s steps(1) infinite; }
.intro-live .send { flex: none; display: grid; place-items: center; width: calc(var(--ph) - var(--u) * 3.2); aspect-ratio: 1; margin-left: auto; border-radius: 50%; background: #141414; color: #fff; }
.intro-live .send svg { width: 46%; height: 46%; }
@media (prefers-color-scheme: dark) { .intro-live .send { background: #f2efe9; color: #141414; } }
.intro-live .prompt.link { font-family: var(--mono); font-size: calc(var(--u) * 2.8 * var(--k)); }
.intro-live .prompt.link .caret { display: none; }

/* Other people's cards, when it is shared. */
.intro-live .ghost { position: absolute; z-index: 1; left: 50%; top: 50%; display: flex; flex-direction: column; gap: calc(var(--u) * 5); width: calc(var(--u) * 100); height: calc(var(--u) * var(--ch)); padding: calc(var(--u) * 7); border-radius: calc(var(--u) * 6); background: color-mix(in srgb, var(--ink) 8%, var(--bg-raised)); opacity: 0; translate: -50% -50%; scale: 0.6; transition: translate 0.9s var(--ease), scale 0.9s var(--ease), rotate 0.9s var(--ease), opacity 0.6s; }
.intro-live.shared .ghost { opacity: 1; scale: 0.64; }
.intro-live.shared .ghost.left { translate: calc(-50% - var(--u) * 24) -53%; rotate: -9deg; transition-delay: 0.15s; }
.intro-live.shared .ghost.right { translate: calc(-50% + var(--u) * 24) -53%; rotate: 9deg; transition-delay: 0.25s; }
.intro-live .ghost b { flex: none; width: 60%; height: calc(var(--u) * 9); border-radius: calc(var(--u) * 2); background: color-mix(in srgb, var(--ink) 22%, transparent); }
.intro-live .ghost span { flex: 1; display: grid; grid-template: 1fr 1fr / 1fr 1fr; gap: calc(var(--u) * 4); }
.intro-live .ghost span i { border-radius: calc(var(--u) * 4); background: var(--node-1); opacity: 0.7; }
.intro-live .ghost span i:nth-child(2) { background: #7a3cff; }
.intro-live .ghost span i:nth-child(3) { background: var(--node-3); }
.intro-live .ghost span i:nth-child(4) { background: var(--node-4); }
.intro-live .ghost u { position: absolute; right: calc(var(--u) * 5); top: calc(var(--u) * 5); color: var(--node-3); font-size: calc(var(--u) * 7); text-decoration: none; opacity: 0; }
.intro-live.shared .ghost u { animation: intro-pop 0.5s var(--ease) 1.1s both; opacity: 1; }

/* All the steps share one place, so the panel does not move when the text changes. */
.intro-live .steps { display: grid; grid-template-columns: minmax(0, 1fr); width: min(100%, 900px); margin: 0 auto; padding: 0; list-style: none; }
.intro-live .steps li { grid-area: 1 / 1; opacity: 0; transform: translateY(10px); transition: opacity 0.5s, transform 0.6s var(--ease); }
.intro-live .steps li.on { opacity: 1; transform: none; transition-delay: 0.15s; }
.intro-live .steps small { color: var(--glow, var(--node-1)); font: 500 13px var(--mono); }
.intro-live .steps h3 { margin: 6px 0; font-size: clamp(20px, 3vmin, 28px); font-weight: 500; letter-spacing: -0.035em; line-height: 1.1; }
.intro-live .steps em, .intro-end h2 em { color: var(--node-3); font-style: normal; }
.intro-live .steps p { margin: 0; color: var(--ink-2); font-size: clamp(14px, 2vmin, 17px); line-height: 1.5; }
.intro-live .steps u { display: block; height: 1px; margin-top: 12px; background: var(--line); text-decoration: none; }
.intro-live .steps u i { display: block; height: 100%; background: var(--ink); transform: scaleX(0); transform-origin: left; }

/* The end: the site's opening, the name resting on its line. */
.intro-end { display: flex; flex-direction: column; justify-content: center; padding: clamp(16px, 4vh, 40px) var(--gutter) 24px; }
.intro-end .mark { overflow: hidden; }
.intro-end .wordmark { display: block; width: min(100%, 118vh); height: auto; }
.intro-end .wm-tinker { fill: #121212; }
.intro-end .wm-click { fill: #2b4dff; }
@media (prefers-color-scheme: dark) {
  .intro-end .wm-tinker { fill: #eee9e2; }
  .intro-end .wm-click { fill: #7590ff; }
}
.intro-end > .rule { display: block; flex: none; height: 4px; width: 100%; margin-top: clamp(10px, 2vh, 20px); background: var(--ink); transform-origin: left; }
#intro[data-scene="end"] .intro-end > .rule { animation: intro-draw 0.7s var(--ease-in-out) both; }
#intro[data-scene="end"] .intro-end .wordmark { animation: intro-from-line 1s var(--ease) 0.3s both; }
.intro-end .grid { display: flex; justify-content: space-between; gap: 24px; padding-top: clamp(14px, 3vh, 32px); }
.intro-end .statement { max-width: 620px; }
.intro-end h2 { margin: 0; font-size: clamp(22px, 3.8vmin, 40px); font-weight: 500; letter-spacing: -0.04em; line-height: 1.08; text-wrap: balance; }
.intro-end p { margin: 10px 0 0; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.intro-end .says { display: none; margin: 10px 0 0; padding: 0; list-style: none; color: var(--ink-2); line-height: 1.6; }
.intro-end .acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: clamp(14px, 3vh, 24px); }
.intro-end .acts button { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 22px; border-radius: 999px; font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; transition: transform 0.3s var(--ease), background-color 0.25s, border-color 0.25s; }
.intro-end .primary { border: 1px solid var(--ink); background: var(--ink); color: var(--on-ink); }
.intro-end .primary span { font-size: 18px; line-height: 1; transition: transform 0.3s var(--ease); }
.intro-end .primary:hover span { transform: rotate(90deg); }
.intro-end .secondary { border: 1px solid var(--line); background: none; color: var(--ink); }
.intro-end .secondary:hover { border-color: var(--ink); }
.intro-end .acts button:active { transform: scale(0.97); }
.intro-end .acts button:focus-visible { outline: 2px solid var(--node-1); outline-offset: 3px; }
.intro-end .orb-spot { flex: none; align-self: flex-end; width: clamp(96px, 22vmin, 200px); aspect-ratio: 1; }
#intro[data-scene="end"] .statement > * { animation: intro-slide-in 1.1s var(--ease) both; }
#intro[data-scene="end"] .statement > :nth-child(2), #intro[data-scene="end"] .statement > p { animation-delay: 0.65s; }
#intro[data-scene="end"] .statement > h2 { animation-delay: 0.5s; }
#intro[data-scene="end"] .statement > .acts { animation-delay: 0.8s; }

/* Like the last screen's second button; on its own background, since the scenes pass behind it. */
.intro-skip { position: absolute; z-index: 3; right: var(--gutter); bottom: 16px; height: 36px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink); font: 500 13px var(--body); cursor: pointer; transition: transform 0.3s var(--ease), border-color 0.25s; }
.intro-skip:hover, .intro-skip:focus-visible { border-color: var(--ink); outline: none; }
.intro-skip:active { transform: scale(0.97); }

@keyframes intro-fade { from { opacity: 0; } }
@keyframes intro-rise {
  0% { transform: translateY(calc(100% + 1em)); animation-timing-function: var(--ease); }
  45%, 70% { transform: none; animation-timing-function: cubic-bezier(0.7, 0, 0.84, 0); }
  100% { transform: translateY(calc(100% + 1em)); }
}
@keyframes intro-roll-left { from { transform: translateX(0); } to { transform: translateX(-18%); } }
@keyframes intro-roll-right { from { transform: translateX(-18%); } to { transform: translateX(0); } }
@keyframes intro-tilt { 0%, 30% { transform: rotateX(54deg) rotateZ(-34deg) scale(0.8); } 100% { transform: none; } }
@keyframes intro-lift { 0% { transform: translateZ(0); opacity: 0; } 12% { opacity: 1; } 28%, 45% { transform: translateZ(var(--z)); } 100% { transform: translateZ(0); } }
@keyframes intro-pop { from { opacity: 0; scale: 0.5; } }
@keyframes intro-blink { 50% { opacity: 0; } }
@keyframes intro-draw { from { transform: scaleX(0); } }
@keyframes intro-from-line { from { transform: translateY(105%); } }
@keyframes intro-slide-in { from { opacity: 0; transform: translateX(-48px); } }

/* Reduce motion: no animation at all, just the last screen with what it would have said. */
@media (prefers-reduced-motion: reduce) {
  .intro-end .says { display: block; }
}
