# Face-down tarot cards

> Three tarot cards in a fan: the one you pick flips over in 3D and reveals its golden arcana.

- Category: [Radio buttons](https://library.aimran.es/components/radios)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-rd-tarot
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Three cards lie face down in a slight fan, with a navy back, a gold border and a diamond pattern. Picking one flips it over in 3D to show a cream face with a Roman numeral, a line drawn sun, moon or star and its name, while the other two fade back. It is a playful radio group for horoscope pages, quizzes, games and daily prompts.

The main color is the gold and the secondary color the card back, so silver on black or copper on green change the mood. No card is chosen at first, which keeps the reveal; replace the icons and names with your own set.

## Code

### HTML

```html
<fieldset class="uvq04-tar"><legend>Pick a card</legend><div class="dk"><label style="--r:-9deg;--y:0.5em"><input type="radio" name="uvq04-tar"><span class="cd"><span class="bk" aria-hidden="true"></span><span class="fc"><small>XIX</small><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.2"/><path d="M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3M5.3 5.3l2.1 2.1M16.6 16.6l2.1 2.1M5.3 18.7l2.1-2.1M16.6 7.4l2.1-2.1"/></svg><b>The Sun</b></span></span></label><label style="--r:0deg;--y:0em"><input type="radio" name="uvq04-tar"><span class="cd"><span class="bk" aria-hidden="true"></span><span class="fc"><small>XVIII</small><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M15.5 3.5a8.6 8.6 0 1 0 5 14.6A7 7 0 0 1 15.5 3.5z"/></svg><b>The Moon</b></span></span></label><label style="--r:9deg;--y:0.5em"><input type="radio" name="uvq04-tar"><span class="cd"><span class="bk" aria-hidden="true"></span><span class="fc"><small>XVII</small><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 2.5l2.3 6.9 6.9 2.6-6.9 2.6L12 21.5l-2.3-6.9L2.8 12l6.9-2.6z"/></svg><b>The Star</b></span></span></label></div></fieldset>
```

### CSS

```css
.uvq04-tar {
  --c1: #d4a43a;
  --c2: #1d2448;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq04-tar {
  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;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  text-align: center;
}

.uvq04-tar legend {
  padding: 0;
  margin: 0 0 .8em;
  font-weight: 700;
  width: 100%;
  margin-bottom: 1.1em;
}

.uvq04-tar .dk {
  display: flex;
  justify-content: center;
  gap: .5em;
  padding: .5em 0 .3em;
  perspective: 40em;
}

.uvq04-tar label {
  position: relative;
  transform: rotate(var(--r)) translateY(var(--y));
  cursor: pointer;
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq04-tar input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq04-tar .cd {
  position: relative;
  display: block;
  width: 4.6em;
  height: 7.3em;
  transform-style: preserve-3d;
  transition: transform calc(0.8s / var(--k)) cubic-bezier(.22,1,.36,1),opacity calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1),filter calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-tar .bk,.uvq04-tar .fc {
  position: absolute;
  inset: 0;
  border-radius: .45em;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 .6em 1.2em -.5em rgba(0,0,0,.55);
}

.uvq04-tar .bk {
  background: radial-gradient(circle,var(--c2) 0 .9em,transparent .95em),radial-gradient(circle,var(--c1) 0 1.15em,transparent 1.2em),repeating-conic-gradient(from 45deg,color-mix(in srgb,var(--c1) 30%,transparent) 0 25%,transparent 0 50%) 0 0/.7em .7em,var(--c2);
  box-shadow: inset 0 0 0 .28em var(--c2),inset 0 0 0 .36em var(--c1),0 .6em 1.2em -.5em rgba(0,0,0,.55);
}

.uvq04-tar .bk::after {
  content: "✦";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.1em;
  color: var(--c1);
}

.uvq04-tar .fc {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: .55em .3em .6em;
  box-sizing: border-box;
  color: color-mix(in srgb,var(--c1),#3a2a00 45%);
  background: radial-gradient(circle at 50% 45%,color-mix(in srgb,var(--c1) 22%,transparent),transparent 60%),#f7f0de;
  box-shadow: inset 0 0 0 .25em #f7f0de,inset 0 0 0 .32em var(--c1),0 .6em 1.2em -.5em rgba(0,0,0,.55);
  transform: rotateY(180deg);
}

.uvq04-tar .fc small {
  font-family: "Iowan Old Style",Georgia,"Times New Roman",serif;
  font-size: .62em;
  font-weight: 700;
  letter-spacing: .1em;
}

.uvq04-tar .fc svg {
  width: 2.4em;
  height: 2.4em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.uvq04-tar .fc b {
  font-family: "Iowan Old Style",Georgia,"Times New Roman",serif;
  font-size: .52em;
  letter-spacing: .03em;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
}

.uvq04-tar label:hover {
  transform: rotate(var(--r)) translateY(calc(var(--y) - .4em));
}

.uvq04-tar label:active .cd {
  transform: scale(.96);
}

.uvq04-tar input:checked + .cd {
  transform: rotateY(180deg) translateZ(1px);
}

.uvq04-tar label:has(input:checked) {
  transform: rotate(0deg) translateY(-.5em);
  z-index: 2;
}

.uvq04-tar:has(input:checked) label:not(:has(input:checked)) .cd {
  opacity: .6;
  filter: saturate(.6);
}

.uvq04-tar input:focus-visible + .cd {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
  border-radius: .45em;
}

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

### React

```tsx
import type { CSSProperties } from "react";

const css = `
.uvq04-tar {
  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;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  text-align: center;
}

.uvq04-tar legend {
  padding: 0;
  margin: 0 0 .8em;
  font-weight: 700;
  width: 100%;
  margin-bottom: 1.1em;
}

.uvq04-tar .dk {
  display: flex;
  justify-content: center;
  gap: .5em;
  padding: .5em 0 .3em;
  perspective: 40em;
}

.uvq04-tar label {
  position: relative;
  transform: rotate(var(--r)) translateY(var(--y));
  cursor: pointer;
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq04-tar input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq04-tar .cd {
  position: relative;
  display: block;
  width: 4.6em;
  height: 7.3em;
  transform-style: preserve-3d;
  transition: transform calc(0.8s / var(--k)) cubic-bezier(.22,1,.36,1),opacity calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1),filter calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-tar .bk,.uvq04-tar .fc {
  position: absolute;
  inset: 0;
  border-radius: .45em;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 .6em 1.2em -.5em rgba(0,0,0,.55);
}

.uvq04-tar .bk {
  background: radial-gradient(circle,var(--c2) 0 .9em,transparent .95em),radial-gradient(circle,var(--c1) 0 1.15em,transparent 1.2em),repeating-conic-gradient(from 45deg,color-mix(in srgb,var(--c1) 30%,transparent) 0 25%,transparent 0 50%) 0 0/.7em .7em,var(--c2);
  box-shadow: inset 0 0 0 .28em var(--c2),inset 0 0 0 .36em var(--c1),0 .6em 1.2em -.5em rgba(0,0,0,.55);
}

.uvq04-tar .bk::after {
  content: "✦";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.1em;
  color: var(--c1);
}

.uvq04-tar .fc {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: .55em .3em .6em;
  box-sizing: border-box;
  color: color-mix(in srgb,var(--c1),#3a2a00 45%);
  background: radial-gradient(circle at 50% 45%,color-mix(in srgb,var(--c1) 22%,transparent),transparent 60%),#f7f0de;
  box-shadow: inset 0 0 0 .25em #f7f0de,inset 0 0 0 .32em var(--c1),0 .6em 1.2em -.5em rgba(0,0,0,.55);
  transform: rotateY(180deg);
}

.uvq04-tar .fc small {
  font-family: "Iowan Old Style",Georgia,"Times New Roman",serif;
  font-size: .62em;
  font-weight: 700;
  letter-spacing: .1em;
}

.uvq04-tar .fc svg {
  width: 2.4em;
  height: 2.4em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.uvq04-tar .fc b {
  font-family: "Iowan Old Style",Georgia,"Times New Roman",serif;
  font-size: .52em;
  letter-spacing: .03em;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
}

.uvq04-tar label:hover {
  transform: rotate(var(--r)) translateY(calc(var(--y) - .4em));
}

.uvq04-tar label:active .cd {
  transform: scale(.96);
}

.uvq04-tar input:checked + .cd {
  transform: rotateY(180deg) translateZ(1px);
}

.uvq04-tar label:has(input:checked) {
  transform: rotate(0deg) translateY(-.5em);
  z-index: 2;
}

.uvq04-tar:has(input:checked) label:not(:has(input:checked)) .cd {
  opacity: .6;
  filter: saturate(.6);
}

.uvq04-tar input:focus-visible + .cd {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
  border-radius: .45em;
}

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

export default function RdTarot() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#d4a43a",
          "--c2": "#1d2448",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <fieldset className="uvq04-tar"><legend>Pick a card</legend><div className="dk"><label style={{ "--r": "-9deg", "--y": "0.5em" } as CSSProperties}><input type="radio" name="uvq04-tar" /><span className="cd"><span className="bk" aria-hidden="true"></span><span className="fc"><small>XIX</small><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.2" /><path d="M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3M5.3 5.3l2.1 2.1M16.6 16.6l2.1 2.1M5.3 18.7l2.1-2.1M16.6 7.4l2.1-2.1" /></svg><b>The Sun</b></span></span></label><label style={{ "--r": "0deg", "--y": "0em" } as CSSProperties}><input type="radio" name="uvq04-tar" /><span className="cd"><span className="bk" aria-hidden="true"></span><span className="fc"><small>XVIII</small><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M15.5 3.5a8.6 8.6 0 1 0 5 14.6A7 7 0 0 1 15.5 3.5z" /></svg><b>The Moon</b></span></span></label><label style={{ "--r": "9deg", "--y": "0.5em" } as CSSProperties}><input type="radio" name="uvq04-tar" /><span className="cd"><span className="bk" aria-hidden="true"></span><span className="fc"><small>XVII</small><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 2.5l2.3 6.9 6.9 2.6-6.9 2.6L12 21.5l-2.3-6.9L2.8 12l6.9-2.6z" /></svg><b>The Star</b></span></span></label></div></fieldset>
      </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 “Face-down tarot cards” block (Radio buttons) from AIMRAN Library to my project.

## What it is
Three tarot cards in a fan: the one you pick flips over in 3D and reveals its golden arcana.

## Chosen settings
- Main color: #d4a43a
- Secondary color: #1d2448
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Elige una carta"

## 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
import type { CSSProperties } from "react";

const css = `
.uvq04-tar {
  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;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  text-align: center;
}

.uvq04-tar legend {
  padding: 0;
  margin: 0 0 .8em;
  font-weight: 700;
  width: 100%;
  margin-bottom: 1.1em;
}

.uvq04-tar .dk {
  display: flex;
  justify-content: center;
  gap: .5em;
  padding: .5em 0 .3em;
  perspective: 40em;
}

.uvq04-tar label {
  position: relative;
  transform: rotate(var(--r)) translateY(var(--y));
  cursor: pointer;
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq04-tar input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq04-tar .cd {
  position: relative;
  display: block;
  width: 4.6em;
  height: 7.3em;
  transform-style: preserve-3d;
  transition: transform calc(0.8s / var(--k)) cubic-bezier(.22,1,.36,1),opacity calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1),filter calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-tar .bk,.uvq04-tar .fc {
  position: absolute;
  inset: 0;
  border-radius: .45em;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 .6em 1.2em -.5em rgba(0,0,0,.55);
}

.uvq04-tar .bk {
  background: radial-gradient(circle,var(--c2) 0 .9em,transparent .95em),radial-gradient(circle,var(--c1) 0 1.15em,transparent 1.2em),repeating-conic-gradient(from 45deg,color-mix(in srgb,var(--c1) 30%,transparent) 0 25%,transparent 0 50%) 0 0/.7em .7em,var(--c2);
  box-shadow: inset 0 0 0 .28em var(--c2),inset 0 0 0 .36em var(--c1),0 .6em 1.2em -.5em rgba(0,0,0,.55);
}

.uvq04-tar .bk::after {
  content: "✦";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.1em;
  color: var(--c1);
}

.uvq04-tar .fc {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: .55em .3em .6em;
  box-sizing: border-box;
  color: color-mix(in srgb,var(--c1),#3a2a00 45%);
  background: radial-gradient(circle at 50% 45%,color-mix(in srgb,var(--c1) 22%,transparent),transparent 60%),#f7f0de;
  box-shadow: inset 0 0 0 .25em #f7f0de,inset 0 0 0 .32em var(--c1),0 .6em 1.2em -.5em rgba(0,0,0,.55);
  transform: rotateY(180deg);
}

.uvq04-tar .fc small {
  font-family: "Iowan Old Style",Georgia,"Times New Roman",serif;
  font-size: .62em;
  font-weight: 700;
  letter-spacing: .1em;
}

.uvq04-tar .fc svg {
  width: 2.4em;
  height: 2.4em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.uvq04-tar .fc b {
  font-family: "Iowan Old Style",Georgia,"Times New Roman",serif;
  font-size: .52em;
  letter-spacing: .03em;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
}

.uvq04-tar label:hover {
  transform: rotate(var(--r)) translateY(calc(var(--y) - .4em));
}

.uvq04-tar label:active .cd {
  transform: scale(.96);
}

.uvq04-tar input:checked + .cd {
  transform: rotateY(180deg) translateZ(1px);
}

.uvq04-tar label:has(input:checked) {
  transform: rotate(0deg) translateY(-.5em);
  z-index: 2;
}

.uvq04-tar:has(input:checked) label:not(:has(input:checked)) .cd {
  opacity: .6;
  filter: saturate(.6);
}

.uvq04-tar input:focus-visible + .cd {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
  border-radius: .45em;
}

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

export default function RdTarot() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#d4a43a",
          "--c2": "#1d2448",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <fieldset className="uvq04-tar"><legend>Pick a card</legend><div className="dk"><label style={{ "--r": "-9deg", "--y": "0.5em" } as CSSProperties}><input type="radio" name="uvq04-tar" /><span className="cd"><span className="bk" aria-hidden="true"></span><span className="fc"><small>XIX</small><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.2" /><path d="M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3M5.3 5.3l2.1 2.1M16.6 16.6l2.1 2.1M5.3 18.7l2.1-2.1M16.6 7.4l2.1-2.1" /></svg><b>The Sun</b></span></span></label><label style={{ "--r": "0deg", "--y": "0em" } as CSSProperties}><input type="radio" name="uvq04-tar" /><span className="cd"><span className="bk" aria-hidden="true"></span><span className="fc"><small>XVIII</small><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M15.5 3.5a8.6 8.6 0 1 0 5 14.6A7 7 0 0 1 15.5 3.5z" /></svg><b>The Moon</b></span></span></label><label style={{ "--r": "9deg", "--y": "0.5em" } as CSSProperties}><input type="radio" name="uvq04-tar" /><span className="cd"><span className="bk" aria-hidden="true"></span><span className="fc"><small>XVII</small><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 2.5l2.3 6.9 6.9 2.6-6.9 2.6L12 21.5l-2.3-6.9L2.8 12l6.9-2.6z" /></svg><b>The Star</b></span></span></label></div></fieldset>
      </div>
    </>
  );
}
```

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