# Tower crane menu

> A site crane runs its trolley to the section you choose, lowers the hook and lifts it up, where it keeps swaying.

- Category: [Navigation](https://library.aimran.es/components/navigation)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-nav-crane-menu
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

A menu for a construction site: a yellow lattice tower crane stands over a row of concrete blocks, each one a section. When you choose one, the trolley runs along the jib, the cable drops, the hook catches the block and lifts it while the previous one goes back down, and the raised block keeps swaying gently. It suits builders, architects, engineering firms and property developers.

The main color paints the crane and the secondary color the concrete. Four blocks fit the jib best; the speed slider changes how fast the crane works, and reduced motion skips the trip and the swing.

## Code

### HTML

```html
<div class="uvq12-cr"><span class="ms" aria-hidden="true"></span><span class="jb" aria-hidden="true"></span><span class="cw" aria-hidden="true"></span><span class="tr" aria-hidden="true"><i class="cb"><svg viewBox="0 0 24 24"><path d="M12 2v9a4 4 0 1 1-4 4"/></svg></i></span><div class="gd" role="tablist" aria-label="Building site"><button type="button" role="tab" id="uvq12-cr-t0" aria-selected="true" aria-controls="uvq12-cr-p0" tabindex="0" class="up"><span class="bk">Projects</span></button><button type="button" role="tab" id="uvq12-cr-t1" aria-selected="false" aria-controls="uvq12-cr-p1" tabindex="-1"><span class="bk">Studio</span></button><button type="button" role="tab" id="uvq12-cr-t2" aria-selected="false" aria-controls="uvq12-cr-p2" tabindex="-1"><span class="bk">Press</span></button><button type="button" role="tab" id="uvq12-cr-t3" aria-selected="false" aria-controls="uvq12-cr-p3" tabindex="-1"><span class="bk">Contact</span></button></div><span class="gr" aria-hidden="true"></span><div class="pn" role="tabpanel" id="uvq12-cr-p0" aria-labelledby="uvq12-cr-t0">Twelve sites under way this year.</div><div class="pn" role="tabpanel" id="uvq12-cr-p1" aria-labelledby="uvq12-cr-t1" hidden>A team of architects and engineers.</div><div class="pn" role="tabpanel" id="uvq12-cr-p2" aria-labelledby="uvq12-cr-t2" hidden>Awards and recent articles.</div><div class="pn" role="tabpanel" id="uvq12-cr-p3" aria-labelledby="uvq12-cr-t3" hidden>Site visits by appointment.</div></div>
```

### CSS

```css
.uvq12-cr {
  --c1: #f5b301;
  --c2: #a8a29e;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq12-cr {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  width: 22em;
  height: 14.2em;
  --i: 0;
  --h: 1.9em;
}

.uvq12-cr .ms,.uvq12-cr .jb {
  position: absolute;
  background: repeating-linear-gradient(45deg,transparent 0 .42em,var(--c1) .42em .56em),repeating-linear-gradient(-45deg,transparent 0 .42em,var(--c1) .42em .56em);
}

.uvq12-cr .ms {
  left: 1.3em;
  top: 1.6em;
  bottom: 3.2em;
  width: 1.1em;
  border-left: .16em solid var(--c1);
  border-right: .16em solid var(--c1);
}

.uvq12-cr .ms::before {
  content: "";
  position: absolute;
  left: -.16em;
  right: -.16em;
  top: -1.4em;
  height: 1.4em;
  clip-path: polygon(50% 0,100% 100%,0 100%);
  background: var(--c1);
}

.uvq12-cr .jb {
  left: 0;
  right: .3em;
  top: 1.6em;
  height: .95em;
  border-top: .16em solid var(--c1);
  border-bottom: .16em solid var(--c1);
}

.uvq12-cr .cw {
  position: absolute;
  left: .1em;
  top: 2.7em;
  width: 1.1em;
  height: 1.3em;
  border-radius: .15em;
  background: repeating-linear-gradient(180deg,#78716c 0 .4em,#57534e .4em .45em);
}

.uvq12-cr .tr {
  position: absolute;
  z-index: 1;
  top: 2.55em;
  left: calc(3.6em + (100% - 4.3em) * (var(--i) + .5) / 4);
  width: 1.3em;
  height: .5em;
  margin-left: -.65em;
  border-radius: .12em;
  background: #3f3f46;
  transition: left calc(0.85s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq12-cr .cb {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 2px;
  height: var(--h);
  margin-left: -1px;
  background: color-mix(in srgb,var(--fg) 70%,#3f3f46);
  transition: height calc(0.5s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq12-cr .cb svg {
  position: absolute;
  left: 50%;
  bottom: -.75em;
  width: 1em;
  height: 1em;
  margin-left: -.42em;
  fill: none;
  stroke: color-mix(in srgb,var(--fg) 70%,#3f3f46);
  stroke-width: 2.6;
  stroke-linecap: round;
}

.uvq12-cr .gd {
  position: absolute;
  left: 3.6em;
  right: .7em;
  bottom: 3.2em;
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: .35em;
}

.uvq12-cr [role="tab"] {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  height: 2.5em;
  border-radius: .2em;
  translate: 0 0;
  transition: translate calc(0.5s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq12-cr [role="tab"].up {
  translate: 0 -3.1em;
}

.uvq12-cr .bk {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  border-radius: .2em;
  font-size: .68em;
  font-weight: 800;
  letter-spacing: .03em;
  color: #292524;
  background: radial-gradient(circle at 30% 40%,rgba(0,0,0,.06) 1px,transparent 1.5px) 0 0/.5em .5em,linear-gradient(180deg,color-mix(in srgb,var(--c2) 70%,#fff),var(--c2));
  box-shadow: inset 0 -.25em 0 rgba(0,0,0,.12),0 .2em .3em rgba(0,0,0,.3);
  transform-origin: 50% -2em;
}

.uvq12-cr .bk::before {
  content: "";
  position: absolute;
  left: 30%;
  right: 30%;
  top: -.5em;
  height: .5em;
  border: 2px solid #57534e;
  border-bottom: 0;
  border-radius: .4em .4em 0 0;
  opacity: .7;
}

.uvq12-cr .up .bk {
  animation: uvq12-cr 2.6s ease-in-out infinite alternate;
  color: #1c1917;
  box-shadow: inset 0 -.25em 0 rgba(0,0,0,.12),0 0 0 .14em var(--c1),0 1.4em 1em -1em rgba(0,0,0,.35);
}

.uvq12-cr [role="tab"]:hover .bk {
  filter: brightness(1.05);
}

.uvq12-cr [role="tab"]:active .bk {
  transform: scale(.96);
}

.uvq12-cr [role="tab"]:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 2px;
}

.uvq12-cr .gr {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2.75em;
  height: .45em;
  border-top: 2px solid color-mix(in srgb,var(--fg) 35%,transparent);
  background: repeating-linear-gradient(-45deg,color-mix(in srgb,var(--fg) 12%,transparent) 0 2px,transparent 2px .4em);
}

.uvq12-cr .pn {
  position: absolute;
  left: 0;
  right: 0;
  bottom: .5em;
  text-align: center;
  font-size: .8em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  animation: uvq12-cr-in calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq12-cr .pn[hidden] {
  display: none;
}

@keyframes uvq12-cr {
  from {
    transform: rotate(-2.5deg);
  }
  to {
    transform: rotate(2.5deg);
  }
}

@keyframes uvq12-cr-in {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq12-cr,.uvq12-cr *,.uvq12-cr *::before,.uvq12-cr *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
```

### JavaScript

```js
document.querySelectorAll(".uvq12-cr").forEach(el => {
  let tm=[];const K=()=>parseFloat(getComputedStyle(el).getPropertyValue("--k"))||1;const rm=matchMedia("(prefers-reduced-motion: reduce)").matches;const ps=[...el.querySelectorAll('[role="tabpanel"]')];const tb=[...el.querySelectorAll('[role="tab"]')];const sel=(t,f)=>{const i=tb.indexOf(t);tb.forEach((x,j)=>{x.setAttribute("aria-selected",String(j===i));x.tabIndex=j===i?0:-1});ps.forEach((p,j)=>{p.hidden=j!==i});lift(i);if(f)t.focus()};tb.forEach(t=>t.addEventListener("click",()=>sel(t)));el.addEventListener("keydown",e=>{const i=tb.indexOf(document.activeElement);if(i<0)return;const n={ArrowRight:i+1,ArrowDown:i+1,ArrowLeft:i-1,ArrowUp:i-1,Home:0,End:tb.length-1}[e.key];if(n===undefined)return;e.preventDefault();sel(tb[(n+tb.length)%tb.length],1)});
function lift(i){tm.splice(0).forEach(clearTimeout);tb.forEach(b=>b.classList.remove("up"));if(rm){el.style.setProperty("--i",i);tb[i].classList.add("up");el.style.setProperty("--h","1.9em");return}el.style.setProperty("--h","1em");el.style.setProperty("--i",i);tm.push(setTimeout(()=>el.style.setProperty("--h","4.95em"),850/K()));tm.push(setTimeout(()=>{tb[i].classList.add("up");el.style.setProperty("--h","1.9em")},1400/K()))}
return()=>tm.forEach(clearTimeout)
});
```

### React

```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq12-cr {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  width: 22em;
  height: 14.2em;
  --i: 0;
  --h: 1.9em;
}

.uvq12-cr .ms,.uvq12-cr .jb {
  position: absolute;
  background: repeating-linear-gradient(45deg,transparent 0 .42em,var(--c1) .42em .56em),repeating-linear-gradient(-45deg,transparent 0 .42em,var(--c1) .42em .56em);
}

.uvq12-cr .ms {
  left: 1.3em;
  top: 1.6em;
  bottom: 3.2em;
  width: 1.1em;
  border-left: .16em solid var(--c1);
  border-right: .16em solid var(--c1);
}

.uvq12-cr .ms::before {
  content: "";
  position: absolute;
  left: -.16em;
  right: -.16em;
  top: -1.4em;
  height: 1.4em;
  clip-path: polygon(50% 0,100% 100%,0 100%);
  background: var(--c1);
}

.uvq12-cr .jb {
  left: 0;
  right: .3em;
  top: 1.6em;
  height: .95em;
  border-top: .16em solid var(--c1);
  border-bottom: .16em solid var(--c1);
}

.uvq12-cr .cw {
  position: absolute;
  left: .1em;
  top: 2.7em;
  width: 1.1em;
  height: 1.3em;
  border-radius: .15em;
  background: repeating-linear-gradient(180deg,#78716c 0 .4em,#57534e .4em .45em);
}

.uvq12-cr .tr {
  position: absolute;
  z-index: 1;
  top: 2.55em;
  left: calc(3.6em + (100% - 4.3em) * (var(--i) + .5) / 4);
  width: 1.3em;
  height: .5em;
  margin-left: -.65em;
  border-radius: .12em;
  background: #3f3f46;
  transition: left calc(0.85s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq12-cr .cb {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 2px;
  height: var(--h);
  margin-left: -1px;
  background: color-mix(in srgb,var(--fg) 70%,#3f3f46);
  transition: height calc(0.5s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq12-cr .cb svg {
  position: absolute;
  left: 50%;
  bottom: -.75em;
  width: 1em;
  height: 1em;
  margin-left: -.42em;
  fill: none;
  stroke: color-mix(in srgb,var(--fg) 70%,#3f3f46);
  stroke-width: 2.6;
  stroke-linecap: round;
}

.uvq12-cr .gd {
  position: absolute;
  left: 3.6em;
  right: .7em;
  bottom: 3.2em;
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: .35em;
}

.uvq12-cr [role="tab"] {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  height: 2.5em;
  border-radius: .2em;
  translate: 0 0;
  transition: translate calc(0.5s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq12-cr [role="tab"].up {
  translate: 0 -3.1em;
}

.uvq12-cr .bk {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  border-radius: .2em;
  font-size: .68em;
  font-weight: 800;
  letter-spacing: .03em;
  color: #292524;
  background: radial-gradient(circle at 30% 40%,rgba(0,0,0,.06) 1px,transparent 1.5px) 0 0/.5em .5em,linear-gradient(180deg,color-mix(in srgb,var(--c2) 70%,#fff),var(--c2));
  box-shadow: inset 0 -.25em 0 rgba(0,0,0,.12),0 .2em .3em rgba(0,0,0,.3);
  transform-origin: 50% -2em;
}

.uvq12-cr .bk::before {
  content: "";
  position: absolute;
  left: 30%;
  right: 30%;
  top: -.5em;
  height: .5em;
  border: 2px solid #57534e;
  border-bottom: 0;
  border-radius: .4em .4em 0 0;
  opacity: .7;
}

.uvq12-cr .up .bk {
  animation: uvq12-cr 2.6s ease-in-out infinite alternate;
  color: #1c1917;
  box-shadow: inset 0 -.25em 0 rgba(0,0,0,.12),0 0 0 .14em var(--c1),0 1.4em 1em -1em rgba(0,0,0,.35);
}

.uvq12-cr [role="tab"]:hover .bk {
  filter: brightness(1.05);
}

.uvq12-cr [role="tab"]:active .bk {
  transform: scale(.96);
}

.uvq12-cr [role="tab"]:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 2px;
}

.uvq12-cr .gr {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2.75em;
  height: .45em;
  border-top: 2px solid color-mix(in srgb,var(--fg) 35%,transparent);
  background: repeating-linear-gradient(-45deg,color-mix(in srgb,var(--fg) 12%,transparent) 0 2px,transparent 2px .4em);
}

.uvq12-cr .pn {
  position: absolute;
  left: 0;
  right: 0;
  bottom: .5em;
  text-align: center;
  font-size: .8em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  animation: uvq12-cr-in calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq12-cr .pn[hidden] {
  display: none;
}

@keyframes uvq12-cr {
  from {
    transform: rotate(-2.5deg);
  }
  to {
    transform: rotate(2.5deg);
  }
}

@keyframes uvq12-cr-in {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq12-cr,.uvq12-cr *,.uvq12-cr *::before,.uvq12-cr *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  let tm=[];const K=()=>parseFloat(getComputedStyle(el).getPropertyValue("--k"))||1;const rm=matchMedia("(prefers-reduced-motion: reduce)").matches;const ps=[...el.querySelectorAll('[role="tabpanel"]')];const tb=[...el.querySelectorAll('[role="tab"]')];const sel=(t,f)=>{const i=tb.indexOf(t);tb.forEach((x,j)=>{x.setAttribute("aria-selected",String(j===i));x.tabIndex=j===i?0:-1});ps.forEach((p,j)=>{p.hidden=j!==i});lift(i);if(f)t.focus()};tb.forEach(t=>t.addEventListener("click",()=>sel(t)));el.addEventListener("keydown",e=>{const i=tb.indexOf(document.activeElement);if(i<0)return;const n={ArrowRight:i+1,ArrowDown:i+1,ArrowLeft:i-1,ArrowUp:i-1,Home:0,End:tb.length-1}[e.key];if(n===undefined)return;e.preventDefault();sel(tb[(n+tb.length)%tb.length],1)});
function lift(i){tm.splice(0).forEach(clearTimeout);tb.forEach(b=>b.classList.remove("up"));if(rm){el.style.setProperty("--i",i);tb[i].classList.add("up");el.style.setProperty("--h","1.9em");return}el.style.setProperty("--h","1em");el.style.setProperty("--i",i);tm.push(setTimeout(()=>el.style.setProperty("--h","4.95em"),850/K()));tm.push(setTimeout(()=>{tb[i].classList.add("up");el.style.setProperty("--h","1.9em")},1400/K()))}
return()=>tm.forEach(clearTimeout)
}

export default function NavCraneMenu() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#f5b301",
          "--c2": "#a8a29e",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq12-cr"><span className="ms" aria-hidden="true"></span><span className="jb" aria-hidden="true"></span><span className="cw" aria-hidden="true"></span><span className="tr" aria-hidden="true"><i className="cb"><svg viewBox="0 0 24 24"><path d="M12 2v9a4 4 0 1 1-4 4" /></svg></i></span><div className="gd" role="tablist" aria-label="Building site"><button type="button" role="tab" id="uvq12-cr-t0" aria-selected="true" aria-controls="uvq12-cr-p0" tabIndex={0} className="up"><span className="bk">Projects</span></button><button type="button" role="tab" id="uvq12-cr-t1" aria-selected="false" aria-controls="uvq12-cr-p1" tabIndex={-1}><span className="bk">Studio</span></button><button type="button" role="tab" id="uvq12-cr-t2" aria-selected="false" aria-controls="uvq12-cr-p2" tabIndex={-1}><span className="bk">Press</span></button><button type="button" role="tab" id="uvq12-cr-t3" aria-selected="false" aria-controls="uvq12-cr-p3" tabIndex={-1}><span className="bk">Contact</span></button></div><span className="gr" aria-hidden="true"></span><div className="pn" role="tabpanel" id="uvq12-cr-p0" aria-labelledby="uvq12-cr-t0">Twelve sites under way this year.</div><div className="pn" role="tabpanel" id="uvq12-cr-p1" aria-labelledby="uvq12-cr-t1" hidden={true}>A team of architects and engineers.</div><div className="pn" role="tabpanel" id="uvq12-cr-p2" aria-labelledby="uvq12-cr-t2" hidden={true}>Awards and recent articles.</div><div className="pn" role="tabpanel" id="uvq12-cr-p3" aria-labelledby="uvq12-cr-t3" hidden={true}>Site visits by appointment.</div></div>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Tower crane menu” block (Navigation) from AIMRAN Library to my project.

## What it is
A site crane runs its trolley to the section you choose, lowers the hook and lifts it up, where it keeps swaying.

## Chosen settings
- Main color: #f5b301
- Secondary color: #a8a29e
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Obra"

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with plain HTML and CSS (the reference wraps it in a React component with its CSS). If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq12-cr {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  width: 22em;
  height: 14.2em;
  --i: 0;
  --h: 1.9em;
}

.uvq12-cr .ms,.uvq12-cr .jb {
  position: absolute;
  background: repeating-linear-gradient(45deg,transparent 0 .42em,var(--c1) .42em .56em),repeating-linear-gradient(-45deg,transparent 0 .42em,var(--c1) .42em .56em);
}

.uvq12-cr .ms {
  left: 1.3em;
  top: 1.6em;
  bottom: 3.2em;
  width: 1.1em;
  border-left: .16em solid var(--c1);
  border-right: .16em solid var(--c1);
}

.uvq12-cr .ms::before {
  content: "";
  position: absolute;
  left: -.16em;
  right: -.16em;
  top: -1.4em;
  height: 1.4em;
  clip-path: polygon(50% 0,100% 100%,0 100%);
  background: var(--c1);
}

.uvq12-cr .jb {
  left: 0;
  right: .3em;
  top: 1.6em;
  height: .95em;
  border-top: .16em solid var(--c1);
  border-bottom: .16em solid var(--c1);
}

.uvq12-cr .cw {
  position: absolute;
  left: .1em;
  top: 2.7em;
  width: 1.1em;
  height: 1.3em;
  border-radius: .15em;
  background: repeating-linear-gradient(180deg,#78716c 0 .4em,#57534e .4em .45em);
}

.uvq12-cr .tr {
  position: absolute;
  z-index: 1;
  top: 2.55em;
  left: calc(3.6em + (100% - 4.3em) * (var(--i) + .5) / 4);
  width: 1.3em;
  height: .5em;
  margin-left: -.65em;
  border-radius: .12em;
  background: #3f3f46;
  transition: left calc(0.85s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq12-cr .cb {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 2px;
  height: var(--h);
  margin-left: -1px;
  background: color-mix(in srgb,var(--fg) 70%,#3f3f46);
  transition: height calc(0.5s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq12-cr .cb svg {
  position: absolute;
  left: 50%;
  bottom: -.75em;
  width: 1em;
  height: 1em;
  margin-left: -.42em;
  fill: none;
  stroke: color-mix(in srgb,var(--fg) 70%,#3f3f46);
  stroke-width: 2.6;
  stroke-linecap: round;
}

.uvq12-cr .gd {
  position: absolute;
  left: 3.6em;
  right: .7em;
  bottom: 3.2em;
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: .35em;
}

.uvq12-cr [role="tab"] {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  height: 2.5em;
  border-radius: .2em;
  translate: 0 0;
  transition: translate calc(0.5s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq12-cr [role="tab"].up {
  translate: 0 -3.1em;
}

.uvq12-cr .bk {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  border-radius: .2em;
  font-size: .68em;
  font-weight: 800;
  letter-spacing: .03em;
  color: #292524;
  background: radial-gradient(circle at 30% 40%,rgba(0,0,0,.06) 1px,transparent 1.5px) 0 0/.5em .5em,linear-gradient(180deg,color-mix(in srgb,var(--c2) 70%,#fff),var(--c2));
  box-shadow: inset 0 -.25em 0 rgba(0,0,0,.12),0 .2em .3em rgba(0,0,0,.3);
  transform-origin: 50% -2em;
}

.uvq12-cr .bk::before {
  content: "";
  position: absolute;
  left: 30%;
  right: 30%;
  top: -.5em;
  height: .5em;
  border: 2px solid #57534e;
  border-bottom: 0;
  border-radius: .4em .4em 0 0;
  opacity: .7;
}

.uvq12-cr .up .bk {
  animation: uvq12-cr 2.6s ease-in-out infinite alternate;
  color: #1c1917;
  box-shadow: inset 0 -.25em 0 rgba(0,0,0,.12),0 0 0 .14em var(--c1),0 1.4em 1em -1em rgba(0,0,0,.35);
}

.uvq12-cr [role="tab"]:hover .bk {
  filter: brightness(1.05);
}

.uvq12-cr [role="tab"]:active .bk {
  transform: scale(.96);
}

.uvq12-cr [role="tab"]:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 2px;
}

.uvq12-cr .gr {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2.75em;
  height: .45em;
  border-top: 2px solid color-mix(in srgb,var(--fg) 35%,transparent);
  background: repeating-linear-gradient(-45deg,color-mix(in srgb,var(--fg) 12%,transparent) 0 2px,transparent 2px .4em);
}

.uvq12-cr .pn {
  position: absolute;
  left: 0;
  right: 0;
  bottom: .5em;
  text-align: center;
  font-size: .8em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  animation: uvq12-cr-in calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq12-cr .pn[hidden] {
  display: none;
}

@keyframes uvq12-cr {
  from {
    transform: rotate(-2.5deg);
  }
  to {
    transform: rotate(2.5deg);
  }
}

@keyframes uvq12-cr-in {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq12-cr,.uvq12-cr *,.uvq12-cr *::before,.uvq12-cr *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  let tm=[];const K=()=>parseFloat(getComputedStyle(el).getPropertyValue("--k"))||1;const rm=matchMedia("(prefers-reduced-motion: reduce)").matches;const ps=[...el.querySelectorAll('[role="tabpanel"]')];const tb=[...el.querySelectorAll('[role="tab"]')];const sel=(t,f)=>{const i=tb.indexOf(t);tb.forEach((x,j)=>{x.setAttribute("aria-selected",String(j===i));x.tabIndex=j===i?0:-1});ps.forEach((p,j)=>{p.hidden=j!==i});lift(i);if(f)t.focus()};tb.forEach(t=>t.addEventListener("click",()=>sel(t)));el.addEventListener("keydown",e=>{const i=tb.indexOf(document.activeElement);if(i<0)return;const n={ArrowRight:i+1,ArrowDown:i+1,ArrowLeft:i-1,ArrowUp:i-1,Home:0,End:tb.length-1}[e.key];if(n===undefined)return;e.preventDefault();sel(tb[(n+tb.length)%tb.length],1)});
function lift(i){tm.splice(0).forEach(clearTimeout);tb.forEach(b=>b.classList.remove("up"));if(rm){el.style.setProperty("--i",i);tb[i].classList.add("up");el.style.setProperty("--h","1.9em");return}el.style.setProperty("--h","1em");el.style.setProperty("--i",i);tm.push(setTimeout(()=>el.style.setProperty("--h","4.95em"),850/K()));tm.push(setTimeout(()=>{tb[i].classList.add("up");el.style.setProperty("--h","1.9em")},1400/K()))}
return()=>tm.forEach(clearTimeout)
}

export default function NavCraneMenu() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#f5b301",
          "--c2": "#a8a29e",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq12-cr"><span className="ms" aria-hidden="true"></span><span className="jb" aria-hidden="true"></span><span className="cw" aria-hidden="true"></span><span className="tr" aria-hidden="true"><i className="cb"><svg viewBox="0 0 24 24"><path d="M12 2v9a4 4 0 1 1-4 4" /></svg></i></span><div className="gd" role="tablist" aria-label="Building site"><button type="button" role="tab" id="uvq12-cr-t0" aria-selected="true" aria-controls="uvq12-cr-p0" tabIndex={0} className="up"><span className="bk">Projects</span></button><button type="button" role="tab" id="uvq12-cr-t1" aria-selected="false" aria-controls="uvq12-cr-p1" tabIndex={-1}><span className="bk">Studio</span></button><button type="button" role="tab" id="uvq12-cr-t2" aria-selected="false" aria-controls="uvq12-cr-p2" tabIndex={-1}><span className="bk">Press</span></button><button type="button" role="tab" id="uvq12-cr-t3" aria-selected="false" aria-controls="uvq12-cr-p3" tabIndex={-1}><span className="bk">Contact</span></button></div><span className="gr" aria-hidden="true"></span><div className="pn" role="tabpanel" id="uvq12-cr-p0" aria-labelledby="uvq12-cr-t0">Twelve sites under way this year.</div><div className="pn" role="tabpanel" id="uvq12-cr-p1" aria-labelledby="uvq12-cr-t1" hidden={true}>A team of architects and engineers.</div><div className="pn" role="tabpanel" id="uvq12-cr-p2" aria-labelledby="uvq12-cr-t2" hidden={true}>Awards and recent articles.</div><div className="pn" role="tabpanel" id="uvq12-cr-p3" aria-labelledby="uvq12-cr-t3" hidden={true}>Site visits by appointment.</div></div>
      </div>
    </>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
