/* Hero, after Cartons: one scene in Keyrate's own objects. A keyboard lies under the title and types real quotes from the
   test, a wrong key flashing red now and then; the five keys it misses most keep a red ring, like the result screen.
   Loose keycaps drift around it at three depths. hero.js moves every layer at its own scroll speed. */
.lp-hero { isolation: isolate; overflow: hidden; justify-content: flex-start;
           padding-top: clamp(96px, 16vh, 168px); padding-bottom: calc(var(--k) * 5.4);
           --miss: #007aff; --k: clamp(28px, 6.2vw, 82px); --gap: calc(var(--k) * .14); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lp-hero { --miss: #0a84ff; } }
:root[data-theme="dark"] .lp-hero { --miss: #0a84ff; }
.lp-hero .hero-copy { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; }

/* the ground: the keyboard, tilted onto the desk, feathered at the edges */
.backdrop { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
            -webkit-mask-image: linear-gradient(#000 62%, transparent); mask-image: linear-gradient(#000 82%, transparent); }
.backdrop::after { content: ""; position: absolute; inset: 0;
            background: radial-gradient(ellipse 42% 34% at 50% 34%, color-mix(in srgb, var(--bg) 90%, transparent),
                        color-mix(in srgb, var(--bg) 50%, transparent) 70%, color-mix(in srgb, var(--bg) 15%, transparent)); }
.ground { position: absolute; left: 0; right: 0; bottom: calc(var(--k) * .4); display: flex; justify-content: center; will-change: transform;
          -webkit-mask-image: radial-gradient(ellipse 60% 75% at 50% 45%, #000 60%, transparent 100%);
          mask-image: radial-gradient(ellipse 60% 75% at 50% 45%, #000 60%, transparent 100%); }
.kb { display: flex; flex-direction: column; gap: var(--gap); transform: perspective(1600px) rotateX(32deg); transform-origin: 50% 100%; }
.kb-row { display: flex; gap: var(--gap); }
.kb-row:nth-child(2) { margin-left: calc(var(--k) * .5); }
.kb-row:nth-child(3) { margin-left: calc(var(--k) * 1.5); }
.kb-row:nth-child(4) { justify-content: center; margin-left: calc(var(--k) * 1.2); }

.key, .cap { display: grid; place-items: center; aspect-ratio: 1; border-radius: calc(var(--k) * .16);
       background: var(--bg2); border: 1px solid var(--border); box-shadow: 0 calc(var(--k) * .05) 0 var(--border);
       color: var(--text3); font-weight: 600; text-transform: lowercase; user-select: none; }
.key { width: var(--k); font-size: calc(var(--k) * .3);
       transition: translate .09s ease-out, box-shadow .09s ease-out, background-color .35s, color .35s, outline-color .6s; outline: 2px solid transparent; outline-offset: 2px; }
.key.space { width: calc(var(--k) * 5.6); aspect-ratio: auto; height: var(--k); }
.key.down { translate: 0 calc(var(--k) * .05); box-shadow: none; background: var(--text); color: var(--bg); transition-duration: .04s; }
.key.miss { background: var(--miss); border-color: var(--miss); color: #fff; transition-duration: .04s; }
.key.worst { outline-color: color-mix(in srgb, var(--miss) 70%, transparent); color: var(--miss); }

/* the sky: loose keycaps at three depths */
.sky { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden;
       -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.sky .layer { position: absolute; inset: 0; will-change: transform; }
.cap { position: absolute; --k: var(--s); width: var(--s); font-size: calc(var(--s) * .4); animation: drift ease-in-out infinite alternate; }
.cap.red { color: var(--miss); outline: 2px solid color-mix(in srgb, var(--miss) 60%, transparent); outline-offset: 2px; }
.sky .far .cap { filter: blur(.8px); }
.sky .near .cap { filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .14)); }
@keyframes drift { from { transform: translateY(-10px) rotate(var(--r)); } to { transform: translateY(10px) rotate(calc(var(--r) + 8deg)); } }

@media (max-width: 560px) { .lp-hero { --k: 11.5vw; } .kb { transform: perspective(900px) rotateX(28deg); } } /* wider than the phone: the edges feather off */
@media (prefers-reduced-motion: reduce) { .cap { animation: none; } }
#lp-bg { display: none; } /* the shared bars field; the keyboard scene replaces it */

/* type rhythm: one scale step between each line, tracking eased off the shared -.035em so the headline breathes */
.lp-hero h1 { font-size: clamp(2.75rem, 7.2vw, 5.25rem); letter-spacing: -.028em; line-height: 1.04; margin-top: 0; }
.lp-hero .lp-lede { font-size: clamp(1.0625rem, 1.6vw, 1.25rem); margin-top: 16px; letter-spacing: -.005em; }
.lp-hero .lp-cta { margin-top: 32px; }
.lp-hero .lp-btn { padding: 12px 22px; font-size: 1rem; }

/* top bar: the logo left, the account right; it sits over the hero and scrolls away with it */
.topbar { position: absolute; z-index: 10; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between;
          padding: 16px clamp(16px, 3vw, 32px); }
.topbar a:focus-visible { outline: 2px solid var(--miss); outline-offset: 2px; }
.tb-brand { display: flex; align-items: center; gap: 8px; min-height: 40px; font-weight: 650; font-size: 1.0625rem; letter-spacing: -.01em; }
.tb-brand img { border-radius: 8px; display: block; }
.tb-acct { display: flex; align-items: center; gap: 6px; }
.tb-link, .tb-btn { display: inline-flex; align-items: center; min-height: 40px; font-size: .9375rem; font-weight: 600; padding: 0 16px; border-radius: 999px; line-height: 1; }
.tb-link { color: var(--text2); } .tb-link:hover { color: var(--text); }
.tb-btn { background: var(--text); color: var(--bg); } .tb-btn:hover { opacity: .88; }
@media (max-width: 380px) { .tb-brand span { display: none; } }

/* the demo readout: the speed it is typing at, and the line as it comes out */
.lp-hero .demo { margin-top: 32px; display: flex; align-items: center; gap: 12px; max-width: min(92vw, 640px);
                 font-size: 1rem; color: var(--text2); white-space: nowrap; }
.demo-wpm { flex: none; font-variant-numeric: tabular-nums; padding: 4px 10px; border-radius: 999px; font-size: .8125rem;
            background: color-mix(in srgb, var(--miss) 12%, transparent); color: var(--miss-ink); font-weight: 600; }
.demo-wpm b { display: inline-block; min-width: 3ch; text-align: right; font-weight: 700; }
.demo-line { overflow: hidden; text-overflow: clip; min-height: 1.6em; }
.demo-line::after { content: ""; display: inline-block; width: 2px; height: 1.1em; margin-left: 1px; vertical-align: -.18em; background: var(--miss); animation: blink 1s steps(1) infinite; }
.demo-line i { font-style: normal; color: #fff; background: var(--miss); border-radius: 3px; padding: 0 1px; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .lp-hero .demo { display: none; } }
