/* Rubik's cube (cube.jsx). Sizes are authored at 60px per small cube;
   --rc-scale shrinks/grows the whole cube for different screens. */

/* ── Palettes ──
   Slots: c0 right, c1 left, c2 top, c3 bottom, c4 front, c5 back.
   "muted": the six classic colours, toned down to the same softness so
   none shouts (used by the solver, where telling faces apart matters).
   "mono": greys from the site's ink colour down, plus the site accent. */
.rc-stage{
  --rc-body: #101217;
  --rc-c0: oklch(62% 0.15 25);     /* soft red */
  --rc-c1: oklch(76% 0.11 60);
  --rc-c2: oklch(95% 0.006 85);
  --rc-c3: oklch(87% 0.09 95);
  --rc-c4: oklch(70% 0.085 170);
  --rc-c5: oklch(62% 0.09 255);
}
/* "hero": the homepage cube's palette. Similar shades (sage/slate) sit on
   opposite faces so they're never seen side by side. */
.rc-stage[data-palette="hero"]{
  --rc-body: #1a1d1c;
  --rc-c0: #A29B90;   /* right: taupe */
  --rc-c1: #405F52;   /* left: deep green */
  --rc-c2: #EAEAE6;   /* top: ivory */
  --rc-c3: #343A38;   /* bottom: charcoal */
  --rc-c4: #829A8D;   /* front: sage */
  --rc-c5: #84929A;   /* back: slate */
}
.rc-stage[data-palette="mono"]{
  --rc-body: #0b0c10;
  --rc-c0: var(--accent, #E63946);
  --rc-c1: oklch(52% 0.012 260);
  --rc-c2: oklch(95% 0.006 85);
  --rc-c3: oklch(40% 0.012 260);
  --rc-c4: oklch(72% 0.01 260);
  --rc-c5: oklch(66% 0.01 260);
}

.rc-stage{
  --rc-scale: 1.35;
  width: calc(180px * var(--rc-scale) * 1.7);
  height: calc(180px * var(--rc-scale) * 1.7);
  display: grid;
  place-items: center;
  perspective: 1400px;
  cursor: grab;
  touch-action: none;           /* let drags rotate the cube instead of scrolling */
  user-select: none;
  -webkit-user-select: none;
}
.rc-stage:active{ cursor: grabbing }

.rc-view{
  --rc-rx: -28deg;
  --rc-ry: -38deg;
  position: relative;
  width: 0; height: 0;
  transform-style: preserve-3d;
  transform: scale3d(var(--rc-scale), var(--rc-scale), var(--rc-scale))
             rotateX(var(--rc-rx)) rotateY(var(--rc-ry));
}

.rc-cubie{
  position: absolute;
  left: -30px; top: -30px;
  width: 60px; height: 60px;
  transform-style: preserve-3d;
}

.rc-face{
  position: absolute;
  inset: 0;
  background: var(--rc-body);    /* plastic body */
  border-radius: 7px;
  backface-visibility: hidden;
}

.rc-sticker{
  position: absolute;
  inset: 4px;
  border-radius: 6px;
  background-image: linear-gradient(150deg, rgba(255,255,255,.14), rgba(255,255,255,0) 50%, rgba(0,0,0,.10));
}

/* A small celebratory hop once the cube is solved. Runs once on the
   compositor — no JavaScript, no ongoing cost. */
.rc-stage:has(.rc-solved){ animation: rc-hop .6s cubic-bezier(.3,1.6,.5,1) both }
@keyframes rc-hop{
  0%   { transform: scale(1) }
  40%  { transform: scale(1.06) }
  100% { transform: scale(1) }
}

@media (max-width: 900px){
  .rc-stage{ --rc-scale: 1.05 }
}
@media (max-width: 760px){
  .rc-stage{
    --rc-scale: .85;
    margin: 0 auto;
    height: calc(180px * var(--rc-scale) * 1.4);   /* less empty space above the text */
  }
}
@media (prefers-reduced-motion: reduce){
  .rc-stage:has(.rc-solved){ animation: none }
}

/* ── solver controls ── */
.rc-solver{ display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100% }
.rc-controls{ display: flex; gap: 12px }
.rc-btn{
  appearance: none; cursor: pointer;
  padding: 12px 22px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink);
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  transition: border-color .18s, background-color .18s, opacity .18s, transform .18s;
}
.rc-btn:hover:not(:disabled){ border-color: var(--accent); transform: translateY(-1px) }
.rc-btn.primary{ background: var(--accent); border-color: var(--accent); color: var(--accent-ink) }
.rc-btn:disabled{ opacity: .45; cursor: default }
.rc-status{ margin: 0; font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; color: var(--ink-soft); min-height: 1.4em; text-align: center }
.rc-moves{
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
  max-width: 560px;
}
.rc-moves li{
  min-width: 34px; padding: 5px 8px; border-radius: 8px; text-align: center;
  border: 1px solid var(--line); color: var(--ink-mute);
  font-family: var(--font-mono); font-size: 12px;
  transition: background-color .15s, color .15s, border-color .15s;
}
.rc-moves li.done{ color: var(--ink-soft) }
.rc-moves li.now{ background: var(--accent); border-color: var(--accent); color: var(--accent-ink) }
.rc-hint{ margin: 0; font-size: 13px; color: var(--ink-mute) }
