/* ============ Tokens ============ */
:root {
  --paper: #f2f1ec;
  --card: #fbfaf7;
  --screen: #e9e7df;
  --ink: #121211;
  --ink-2: #4a4944;
  --ink-3: #85837a;
  --line: #121211;
  --soft-line: rgba(18, 18, 17, .12);
  --hl: #d4ff3a;
  --hl-ink: #121211;
  --dot: rgba(18, 18, 17, .13);
  --shadow: 5px 5px 0 var(--ink);
  --sans: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f0f0e; --card: #171715; --screen: #1f1f1c;
    --ink: #f1f0ea; --ink-2: #b4b2a8; --ink-3: #75736b;
    --line: #3a3934; --soft-line: rgba(241, 240, 234, .1);
    --dot: rgba(241, 240, 234, .07); --shadow: 5px 5px 0 var(--hl);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f0f0e; --card: #171715; --screen: #1f1f1c;
  --ink: #f1f0ea; --ink-2: #b4b2a8; --ink-3: #75736b;
  --line: #3a3934; --soft-line: rgba(241, 240, 234, .1);
  --dot: rgba(241, 240, 234, .07); --shadow: 5px 5px 0 var(--hl);
  color-scheme: dark;
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans);
  font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; overflow-x: hidden;
  transition: background-color .3s, color .3s;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
code, kbd { font-family: var(--mono); font-size: .85em; }
kbd { display: inline-block; min-width: 22px; text-align: center; padding: 1px 6px; border: 1.5px solid var(--line); border-bottom-width: 3px; border-radius: 6px; background: var(--card); color: var(--ink); line-height: 1.4; }
code { background: var(--screen); padding: 1px 6px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 3px; }
.hl { background: var(--hl); color: var(--hl-ink); padding: 0 .12em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.dots { position: fixed; inset: 0; z-index: -1; pointer-events: none; background-image: radial-gradient(var(--dot) 1.2px, transparent 1.2px); background-size: 22px 22px; }

/* ============ Nav ============ */
.nav { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px clamp(16px, 4vw, 48px); transition: background-color .3s, border-color .3s; border-bottom: 1.5px solid transparent; }
.nav.scrolled { background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-color: var(--soft-line); }
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 22px; letter-spacing: -.04em; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: var(--hl); display: grid; place-items: center; transition: transform .3s; }
.logo-mark svg { width: 20px; height: 20px; }
.logo:hover .logo-mark { transform: rotate(-8deg) scale(1.05); }
.nav-links { display: flex; gap: 2px; font-family: var(--mono); font-size: 13px; }
.nav-links a { padding: 7px 12px; border-radius: 6px; color: var(--ink-2); }
.nav-links a:hover { background: var(--ink); color: var(--paper); }
.theme { width: 52px; height: 28px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--card); position: relative; cursor: pointer; padding: 0; }
.theme-knob { position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--ink); transition: transform .3s cubic-bezier(.3,1.4,.5,1); }
:root[data-theme="dark"] .theme-knob { transform: translateX(24px); background: var(--hl); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-knob { transform: translateX(24px); background: var(--hl); } }

/* ============ Hero ============ */
.hero { max-width: 980px; margin: 0 auto; padding: clamp(48px, 11vh, 120px) clamp(16px, 4vw, 48px) clamp(48px, 9vh, 96px); text-align: center; }
.tag { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 26px; padding: 6px 12px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--card); font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.led { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; animation: led 1.6s ease-in-out infinite; }
@keyframes led { 50% { opacity: .3; } }
h1 { font-size: clamp(50px, 10vw, 124px); line-height: .92; letter-spacing: -.055em; font-weight: 700; margin: 0 0 26px; }
.lede { max-width: 600px; margin: 0 auto 40px; font-size: clamp(17px, 1.7vw, 20px); color: var(--ink-2); }

.launcher { position: relative; max-width: 640px; margin: 0 auto; text-align: left; z-index: 5; }
.launch-input { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 16px 0 20px; background: var(--card); border: 2px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.launch-input:focus-within { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
:root[data-theme="dark"] .launch-input:focus-within { box-shadow: 7px 7px 0 var(--hl); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .launch-input:focus-within { box-shadow: 7px 7px 0 var(--hl); } }
.launch-prompt { font-family: var(--mono); font-weight: 600; font-size: 20px; color: var(--ink-3); }
.launch-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 19px; color: var(--ink); }
.launch-input input::placeholder { color: var(--ink-3); }
.launch-list { list-style: none; margin: 10px 0 0; padding: 6px; position: absolute; left: 0; right: 0; background: var(--card); border: 2px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); max-height: 360px; overflow-y: auto; }
.launch-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; cursor: pointer; }
.launch-list li[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.launch-list li[aria-selected="true"] small { color: color-mix(in srgb, var(--paper) 65%, transparent); }
.launch-list .l-icon { width: 34px; height: 34px; flex: none; border-radius: 9px; overflow: hidden; }
.launch-list .l-text { flex: 1; min-width: 0; }
.launch-list strong { display: block; font-size: 15px; }
.launch-list small { display: block; font-family: var(--mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.launch-list .l-go { font-family: var(--mono); font-size: 12px; opacity: .7; }
.launch-list .l-none { color: var(--ink-3); cursor: default; justify-content: center; }
.try { margin: 26px auto 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; font-family: var(--mono); font-size: 13px; color: var(--ink-3); }
.try button { border: 1.5px dashed var(--ink-3); background: transparent; border-radius: 999px; padding: 4px 12px; cursor: pointer; font-family: var(--mono); font-size: 13px; color: var(--ink-2); transition: all .15s; }
.try button:hover { border-style: solid; border-color: var(--ink); background: var(--hl); color: var(--hl-ink); }

/* ============ Ticker ============ */
.ticker { background: var(--ink); color: var(--paper); overflow: hidden; padding: 14px 0; transform: rotate(-1.2deg); margin: 0 -20px; border-block: 2px solid var(--ink); }
.ticker-track { display: flex; width: max-content; gap: 36px; animation: tick 38s linear infinite; font-family: var(--mono); font-size: 15px; text-transform: uppercase; letter-spacing: .04em; }
.ticker-track span { display: inline-flex; gap: 36px; align-items: center; white-space: nowrap; }
.ticker-track span::after { content: "■"; color: var(--hl); font-size: 10px; }
@keyframes tick { to { transform: translateX(-50%); } }

/* ============ Sections ============ */
.section { max-width: 1240px; margin: 0 auto; padding: clamp(72px, 13vh, 128px) clamp(16px, 4vw, 48px) 0; }
.head { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px 24px; margin-bottom: 40px; }
.label { grid-column: 1 / -1; margin: 0 0 8px; font-family: var(--mono); font-size: 12.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); }
h2 { margin: 0; font-size: clamp(38px, 6vw, 72px); line-height: .98; letter-spacing: -.05em; font-weight: 700; }
.head-note { margin: 0; max-width: 300px; font-size: 14px; color: var(--ink-2); text-align: right; }
h3 { margin: 0; letter-spacing: -.03em; }

/* ============ Tools ============ */
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.tool {
  --c: #111;
  position: relative; display: flex; flex-direction: column; background: var(--card); border: 2px solid var(--line);
  border-radius: 16px; overflow: hidden; transition: transform .18s, box-shadow .18s, border-color .18s; outline: none;
}
.tool:hover, .tool:focus-visible, .tool.active { transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--c); border-color: var(--ink); }
.tool.big { grid-column: span 2; grid-row: span 2; }
.tool.wide { grid-column: span 2; }
.screen { position: relative; aspect-ratio: 16 / 10; background: var(--screen); border-bottom: 2px solid var(--line); overflow: hidden; display: grid; place-items: center; }
.tool.big .screen { aspect-ratio: auto; flex: 1; min-height: 260px; }
.screen svg { width: 78%; height: 78%; overflow: visible; }
.screen::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(var(--dot) 1px, transparent 1px); background-size: 14px 14px; pointer-events: none; }
.key { position: absolute; top: 10px; left: 10px; z-index: 2; }
.cat { position: absolute; top: 10px; right: 10px; z-index: 2; font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); color: var(--ink-2); }
.tool-body { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px 18px; }
.icon { width: 44px; height: 44px; flex: none; border-radius: 11px; overflow: hidden; border: 1.5px solid var(--line); }
.icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.glyph { width: 100%; height: 100%; display: grid; place-items: center; background: var(--c); color: #fff; font-weight: 700; font-size: 20px; }
.tool-text { flex: 1; min-width: 0; }
.tool h3 { font-size: 21px; line-height: 1.15; }
.tool .tagline { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.tool .desc { display: none; margin: 10px 0 0; font-size: 15px; color: var(--ink-2); }
.tool.big h3 { font-size: 30px; }
.tool.big .desc { display: block; }
.tool-url { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; border-top: 1.5px dashed var(--soft-line); font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); }
.tool-url b { color: var(--ink); font-weight: 600; }
.tool-url .go { transition: transform .2s; }
.tool:hover .go, .tool.active .go { transform: translateX(4px); color: var(--ink); }
.tool.suggest { border-style: dashed; background: transparent; justify-content: center; padding: 28px; gap: 10px; }
.tool.suggest:hover { box-shadow: 6px 6px 0 var(--hl); }
.tool.suggest h3 { font-size: 24px; }
.tool.suggest p { margin: 0; color: var(--ink-2); font-size: 15px; }
.tool.suggest .plus { font-family: var(--mono); font-size: 13px; color: var(--ink-3); }

/* ---- demo animations ---- */
.d-ink { fill: var(--ink); }
.d-stroke { stroke: var(--ink); fill: none; }
.d-c { fill: var(--c); }
.d-cs { stroke: var(--c); fill: none; }
.d-mono { font-family: var(--mono); fill: var(--ink); }
.d-muted { fill: var(--ink-3); }
.d-card { fill: var(--card); stroke: var(--line); stroke-width: 2; }

/* formula: cycle three lines */
.fx-line { opacity: 0; animation: fx 9s infinite; }
.fx-line:nth-of-type(2) { animation-delay: 3s; }
.fx-line:nth-of-type(3) { animation-delay: 6s; }
@keyframes fx { 0% { opacity: 0; transform: translateY(8px); } 5%, 30% { opacity: 1; transform: none; } 36%, 100% { opacity: 0; transform: translateY(-8px); } }
.fx-caret { animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

/* tabs: slide into a stack */
.tb { animation: tabIn 4.5s cubic-bezier(.3,1.3,.5,1) infinite; }
.tb:nth-of-type(2) { animation-delay: .25s; } .tb:nth-of-type(3) { animation-delay: .5s; } .tb:nth-of-type(4) { animation-delay: .75s; }
@keyframes tabIn { 0%, 8% { transform: translateX(-160px); opacity: 0; } 22%, 78% { transform: none; opacity: 1; } 90%, 100% { transform: translateX(160px); opacity: 0; } }
.tb-save { animation: pop 4.5s infinite; transform-origin: 160px 112px; transform-box: view-box; }
@keyframes pop { 0%, 30% { transform: scale(0); } 38%, 74% { transform: scale(1); } 82%, 100% { transform: scale(0); } }

/* motion: projectile */
.ball { offset-path: path("M20 120 Q 120 -20 220 120"); animation: fly 2.4s cubic-bezier(.35,.05,.65,.95) infinite; }
@keyframes fly { from { offset-distance: 0%; } to { offset-distance: 100%; } }
.trail { stroke-dasharray: 2 7; }

/* bars */
.bar { transform-box: fill-box; transform-origin: bottom; animation: grow 3.6s cubic-bezier(.3,1.4,.5,1) infinite; }
.bar:nth-of-type(2) { animation-delay: .12s; } .bar:nth-of-type(3) { animation-delay: .24s; } .bar:nth-of-type(4) { animation-delay: .36s; } .bar:nth-of-type(5) { animation-delay: .48s; } .bar:nth-of-type(6) { animation-delay: .6s; }
@keyframes grow { 0% { transform: scaleY(0); } 25%, 80% { transform: scaleY(1); } 100% { transform: scaleY(0); } }

/* clock */
.hand-m { transform-origin: 120px 70px; transform-box: view-box; animation: spin 3s linear infinite; }
.hand-h { transform-origin: 120px 70px; transform-box: view-box; animation: spin 36s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* sign */
.sig { stroke-dasharray: 520; stroke-dashoffset: 520; animation: sign 4s ease-in-out infinite; }
@keyframes sign { 0%, 10% { stroke-dashoffset: 520; } 60%, 88% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.pen { offset-path: path("M60 98 c 10 -30 18 -30 14 0 s 10 -24 20 -6 s 16 -22 22 0 s 18 -14 26 2 q 12 -10 30 -4 q 14 4 26 -6"); animation: pen 4s ease-in-out infinite; offset-rotate: 0deg; }
@keyframes pen { 0%, 10% { offset-distance: 0%; } 60%, 100% { offset-distance: 100%; } }

/* ring */
.ring-fill { stroke-dasharray: 251; stroke-dashoffset: 251; transform: rotate(-90deg); transform-origin: 70px 70px; transform-box: view-box; animation: ring 4s cubic-bezier(.3,.9,.4,1) infinite; }
@keyframes ring { 0% { stroke-dashoffset: 251; } 45%, 85% { stroke-dashoffset: 60; } 100% { stroke-dashoffset: 251; } }
.macro { transform-box: fill-box; transform-origin: left; animation: macro 4s cubic-bezier(.3,.9,.4,1) infinite; }
.macro:nth-of-type(2) { animation-delay: .15s; } .macro:nth-of-type(3) { animation-delay: .3s; }
@keyframes macro { 0% { transform: scaleX(0); } 45%, 85% { transform: scaleX(1); } 100% { transform: scaleX(0); } }

/* ============ I want to ============ */
.want-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; align-items: start; }
.want-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.want-chip { border: 2px solid var(--line); background: var(--card); border-radius: 999px; padding: 10px 18px; font-size: 17px; font-weight: 500; cursor: pointer; transition: transform .12s, background-color .15s, box-shadow .15s; }
.want-chip:hover { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--ink); }
.want-chip[aria-selected="true"] { background: var(--hl); color: var(--hl-ink); border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); transform: translate(-2px, -2px); }
.want-result { position: sticky; top: 90px; border: 2px solid var(--ink); border-radius: 18px; background: var(--card); padding: 28px; box-shadow: var(--shadow); min-height: 300px; display: flex; flex-direction: column; gap: 16px; }
.want-result .wr-label { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; margin: 0; }
.want-result .wr-head { display: flex; align-items: center; gap: 14px; }
.want-result .icon { width: 56px; height: 56px; border-radius: 14px; }
.want-result h3 { font-size: 32px; }
.want-result .wr-tag { margin: 0; color: var(--ink-2); }
.want-result .wr-desc { margin: 0; font-size: 17px; }
.want-result .btn { margin-top: auto; align-self: flex-start; }
.wr-anim { animation: wr .35s cubic-bezier(.3,1.3,.5,1); }
@keyframes wr { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ============ Rules ============ */
.rules { display: grid; grid-template-columns: repeat(4, 1fr); border: 2px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--card); }
.rule { padding: 28px 24px 30px; border-right: 2px solid var(--line); }
.rule:last-child { border-right: 0; }
.rule span { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--ink); color: var(--hl); font-family: var(--mono); font-weight: 600; margin-bottom: 36px; }
.rule h3 { font-size: 21px; margin-bottom: 8px; }
.rule p { margin: 0; color: var(--ink-2); font-size: 15px; }

/* ============ Final + footer ============ */
.final { text-align: center; padding-bottom: clamp(72px, 13vh, 128px); }
.final h2 { margin-bottom: 32px; }
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 15px 26px; border-radius: 12px; border: 2px solid var(--ink); background: var(--ink); color: var(--paper); font-weight: 600; font-size: 16px; transition: transform .15s, box-shadow .15s; }
.btn:hover { transform: translate(-3px, -3px); box-shadow: 5px 5px 0 var(--hl); }
.foot { border-top: 2px solid var(--line); padding: 36px clamp(16px, 4vw, 48px); max-width: 1240px; margin: 0 auto; }
.foot-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; }
.foot-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-family: var(--mono); font-size: 13px; }
.foot-list a { color: var(--ink-2); } .foot-list a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--hl); text-decoration-thickness: 3px; }
.foot-copy { margin: 22px 0 0; font-family: var(--mono); font-size: 12px; color: var(--ink-3); }

/* ============ Entrance ============ */
.up { opacity: 0; transform: translateY(16px); animation: up .7s cubic-bezier(.2,.8,.2,1) forwards; }
.hero .up:nth-child(2) { animation-delay: .08s; } .hero .up:nth-child(3) { animation-delay: .16s; } .hero .up:nth-child(4) { animation-delay: .24s; } .hero .up:nth-child(5) { animation-delay: .32s; }
@keyframes up { to { opacity: 1; transform: none; } }
.rise { opacity: 0; transform: translateY(24px); transition: opacity .6s cubic-bezier(.2,.8,.2,1), transform .6s cubic-bezier(.2,.8,.2,1), box-shadow .18s, border-color .18s; }
.rise.in { opacity: 1; transform: none; }
.tool.rise.in:hover, .tool.rise.in:focus-visible, .tool.rise.in.active { transform: translate(-3px, -3px); transition-duration: .18s; }

/* ============ Responsive ============ */
@media (max-width: 1020px) {
  .tools { grid-template-columns: repeat(2, 1fr); }
  .tool.big { grid-row: auto; }
  .rules { grid-template-columns: repeat(2, 1fr); }
  .rule:nth-child(2) { border-right: 0; }
  .rule:nth-child(-n+2) { border-bottom: 2px solid var(--line); }
  .want-grid { grid-template-columns: 1fr; }
  .want-result { position: static; min-height: 0; }
}
@media (max-width: 640px) {
  .nav-links { display: none; }
  .tools { grid-template-columns: 1fr; }
  .tool.big, .tool.wide { grid-column: auto; }
  .tool.big .screen { min-height: 0; aspect-ratio: 16 / 10; }
  .tool.big h3 { font-size: 24px; }
  .head { grid-template-columns: 1fr; }
  .head-note { text-align: left; }
  .head-note, .key { display: none; }
  .rules { grid-template-columns: 1fr; }
  .rule { border-right: 0; border-bottom: 2px solid var(--line); }
  .rule:last-child { border-bottom: 0; }
  .launch-input { height: 58px; }
  .launch-input input { font-size: 17px; }
  .launch-input kbd { display: none; }
  .want-chip { font-size: 15px; padding: 8px 14px; }
  .want-result { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .up, .rise { opacity: 1; transform: none; }
  .fx-line:first-of-type { opacity: 1; }
  .sig { stroke-dashoffset: 0; } .ring-fill { stroke-dashoffset: 60; }
}
